#21588: "Modifying upload handlers on the fly" documentation doesn't replicate
internal magic
-----------------------------------------+--------------------
Reporter: Keryn Knight <django@…> | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------------+--------------------
In the documentation for
[https://docs.djangoproject.com/en/dev/topics/http/file-uploads
/#modifying-upload-handlers-on-the-fly modifying upload handlers on a per-
request basis], the examples given imply that simply instantiating a
Handler onto the `upload_handlers` is equivalent to setting them globally
via [https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-
FILE_UPLOAD_HANDLERS FILE_UPLOAD_HANDLERS], however this isn't the case,
because the `_initialize_handlers` method of `HttpRequest` passes `self`
(ie: the `request` parameter in userland code) to the given handler.
Thus copying or subclassing from one of the default handlers doesn't
necessarily work as expected because `request` is always `None` - which is
perfectly valid according to the arguments for, say, `FileUploadHandler`.
It would be prudent to note that custom handlers, if they need arguments
(including request), should do so at the time of instantiation onto the
upload_handlers list
--
Ticket URL: <https://code.djangoproject.com/ticket/21588>
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/080.fbbb62c7e61b9a5f063afa21318bf34a%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.