[Django] #35534: Request attribute upload handlers is immutable when method is POST

8 views
Skip to first unread message

Django

unread,
Jun 19, 2024, 2:27:21 AM6/19/24
to django-...@googlegroups.com
#35534: Request attribute upload handlers is immutable when method is POST
-----------------------------------------+------------------------
Reporter: matsony_15 | Owner: nobody
Type: Bug | Status: new
Component: Generic views | Version: 5.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
Hi, this is copy of #35447. I`m trying to use custom upload handler as its
mentioned ​here (https://docs.djangoproject.com/en/5.0/topics/http/file-
uploads//), but when request method == POST upload_handlers atribute of
request has type immutable list and throws an error. I created a test repo
and provided some additional info in README.md here
https://github.com/Smoooky/custom_upload_handler
--
Ticket URL: <https://code.djangoproject.com/ticket/35534>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 19, 2024, 5:25:32 AM6/19/24
to django-...@googlegroups.com
#35534: Request attribute upload handlers is immutable when method is POST
-------------------------------+--------------------------------------
Reporter: matsony_15 | Owner: nobody
Type: Bug | Status: new
Component: Generic views | Version: 5.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Comment (by Sarah Boyce):

This feels like a duplicate of #26049

In the docs there is a [https://docs.djangoproject.com/en/5.0/topics/http
/file-uploads/#modifying-upload-handlers-on-the-fly note]
> You can only modify upload handlers before accessing request.POST or
request.FILES – it doesn’t make sense to change upload handlers after
upload handling has already started. If you try to modify
request.upload_handlers after reading from request.POST or request.FILES
Django will throw an error.

I suspect the issue is that you're accessing `request.POST` in the init of
`ProgressBarUploadHandler`

If you want to discuss this further, I recommend taking this to the
[https://forum.djangoproject.com/c/users/6 forum] 👍
--
Ticket URL: <https://code.djangoproject.com/ticket/35534#comment:1>

Django

unread,
Jun 19, 2024, 5:25:50 AM6/19/24
to django-...@googlegroups.com
#35534: Request attribute upload handlers is immutable when method is POST
-------------------------------+--------------------------------------
Reporter: matsony_15 | Owner: nobody
Type: Bug | Status: closed
Component: Generic views | Version: 5.0
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Sarah Boyce):

* resolution: => invalid
* status: new => closed

--
Ticket URL: <https://code.djangoproject.com/ticket/35534#comment:2>
Reply all
Reply to author
Forward
0 new messages