Closed AndrewMagliozzi closed 10 years ago
Download button on prod has href=""
Thus the current page just reloads and no GET is performed.
re: filepicker, we'll probably want a method to construct the access URLs. Document.get_file
lets Django-Filepicker code construct that URL. We should check to see if there's a handy way to pull that constructed URL out without downloading the file.
These lines can probably be pulled out into their own function: https://github.com/btbonval/django-filepicker/blob/master/django_filepicker/utils.py#L32-L42
and if that function is called added into FPFileField.get_url
, then we could call fp_file.get_url
:
https://github.com/btbonval/django-filepicker/blob/master/django_filepicker/models.py#L7
Download on prod is replaced by the thing on Beta where one has to be logged in. I'm tracing that to see where it ends up in the code ultimately.
I don't know if this line of code ever executes (pretty sure PDF2HTML
replaces PDFView
), but this will also need to be updated:
https://github.com/FinalsClub/karmaworld/blob/8ecc45d674be9b5957fb2774c637cb8d86342343/karmaworld/apps/notes/views.py#L168
No other instances found in the code outside of references to fp_file
as a model field.
Perhaps FPFileField
should evaluate to get_url
when coerced to a string format? Looking at FPFileField
upstream, it isn't clear where it ever returned the URL by referencing just fp_file
(an FPFileField
model object), but I thought it happened in the past. Guess it was always fp_file.url
(now fp_file.name
)
FPFileField
, once data is in the database, returns a django.db.models.fields.files.FieldFile
. There doesn't appear to be a way to add custom code to that.
The goal is not to store the URL with the signature in the database, but rather, store the URL in the database and add the server's current signature onto the URL. This might be a little more difficult than I had thought due to the game of cups and balls being played by Django.
Yeah, reading into this, I'd have to subclass the Storages (S3boto) in order to modify how the url is retrieved.
That's not the right decision.
So I guess I'll try to make a method in Document
like Document.get_url
which dynamically generates the appropriate URL by reading from self.fp_file.name
for the database URL. Instead of calling object.fp_file.url
or object.fp_file.name
from the templates or wherever, they'd be calling object.get_url()
.
Updated templates appear to allow download now. It says it costs 2 karma points, although I'm fairly sure I had zero. Yup. I've earned -4 karma points!
Cool. Alright, one last test starting totally fresh and then I can push and close out so many tickets.
Fresh VM.
D'aww I got -5 karma points because my note was deleted.
I think this looks good. Finally. Let's start pushing stuff to master.
instead of doing a GET on the fp-filepicker URL, we'll need to use our HMAC strategy.