﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
26049	Request _upload_handlers is immutable?	Alexander Whillas	nobody	"The documentation states (https://docs.djangoproject.com/en/1.8/topics/http/file-uploads/#id1) 
that you can change the upload hander at the beginning of a view by inserting an instance of your upload handler at the beginning of, what turns out to be, an ImmutableList
{{{#!python
request.upload_handlers.insert(0, ProgressBarUploadHandler())
}}}
which is because its... ''immutable''. It `complain()`'s with a weird error:

    You cannot alter upload handlers after the upload has been processed.

which is triggered from `django/utils/datastructures.py` line 500. If one tries the other approach suggested in the documentation 
{{{#!python
request.upload_handlers = [ProgressBarUploadHandler()]
}}}
one gets the same error again only triggered from the setter function in `django/http/request.py` line 215. So `hasattr(self, '_files')` is true even though the error reports `No FILES data` for `FILES`. The solution I came up with that seems to actually use my custom upload hander is:
{{{#!python
request._upload_handlers = ['YoMamasPoject.YoMamasApp.handlers.ProgressBarUploadHandler']
}}}
Which is obviously ugly. 
I guess nobody has written a test to test this feature? Is the `request.upload_handlers` list supposed to be immutable, in which case change the docs or make it mutable? Also ether the setter function for it is wrong or the error report about FILES is wrong, one of them needs to change."	Uncategorized	closed	File uploads/storage	1.8	Normal	worksforme			Unreviewed	0	0	0	0	1	0
