"Modifying upload handlers on the fly" documentation doesn't replicate internal magic
|Reported by:||Keryn Knight <django@…>||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
In the documentation for 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 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