#24105: When upload_to is callable, storage.get_valid_name() does not get called
-------------------------------------+-------------------------------------
Reporter: jbowen7 | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: File | Version: 1.7
uploads/storage |
Severity: Normal | Resolution:
Keywords: upload_to, | Triage Stage: Accepted
get_valid_name |
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by berkerpeksag):
* needs_better_patch: 0 => 1
Comment:
The patch raises a `SyntaxError` at the following line:
{{{#!diff
+ directory_name, filename =
os.path.split(self.upload_to(instance, filename)
}}}
The `else` clause is not needed:
{{{#!python
if callable(self.upload_to):
# do stuff
return os.path.join(self.get_directory_name(),
self.get_filename(filename))
}}}
Indentation should be 4 spaces.
--
Ticket URL: <https://code.djangoproject.com/ticket/24105#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.083be468be7f7460acf61122332e7f25%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.