#17235: Multipartparser shouldn't leave the QueryDict mutable
-------------------------------+------------------------------------
     Reporter:  apollo13       |                    Owner:  nobody
         Type:  Bug            |                   Status:  new
    Component:  HTTP handling  |                  Version:  master
     Severity:  Normal         |               Resolution:
     Keywords:                 |             Triage Stage:  Accepted
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+------------------------------------

Comment (by hirokiky):

 I added a patch.

 But the tests raised 4 errors.
 For example...

 {{{
 ERROR: testEditSaveAs
 (regressiontests.admin_views.tests.AdminViewBasicTest)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File
 "/home/hirokiky/django/kydjango/tests/regressiontests/admin_views/tests.py",
 line 225, in testEditSaveAs
     response = self.client.post('/test_admin/%s/admin_views/section/1/' %
 self.urlbit, post_data)
   File "/home/hirokiky/django/kydjango/tests/django/test/client.py", line
 463, in post
     response = super(Client, self).post(path, data=data,
 content_type=content_type, **extra)
   File "/home/hirokiky/django/kydjango/tests/django/test/client.py", line
 297, in post
     return self.request(**r)
   File "/home/hirokiky/django/kydjango/tests/django/test/client.py", line
 424, in request
     six.reraise(*exc_info)
   File "/home/hirokiky/django/kydjango/tests/django/utils/six.py", line
 313, in reraise
     raise value
   File
 "/home/hirokiky/django/kydjango/tests/django/core/handlers/base.py", line
 115, in get_response
     response = callback(request, *callback_args, **callback_kwargs)
   File
 "/home/hirokiky/django/kydjango/tests/django/contrib/admin/options.py",
 line 371, in wrapper
     return self.admin_site.admin_view(view)(*args, **kwargs)
   File "/home/hirokiky/django/kydjango/tests/django/utils/decorators.py",
 line 91, in _wrapped_view
     response = view_func(request, *args, **kwargs)
   File
 "/home/hirokiky/django/kydjango/tests/django/views/decorators/cache.py",
 line 52, in _wrapped_view_func
     response = view_func(request, *args, **kwargs)
   File
 "/home/hirokiky/django/kydjango/tests/django/contrib/admin/sites.py", line
 202, in inner
     return view(request, *args, **kwargs)
   File "/home/hirokiky/django/kydjango/tests/django/utils/decorators.py",
 line 25, in _wrapper
     return bound_func(*args, **kwargs)
   File "/home/hirokiky/django/kydjango/tests/django/utils/decorators.py",
 line 91, in _wrapped_view
     response = view_func(request, *args, **kwargs)
   File "/home/hirokiky/django/kydjango/tests/django/utils/decorators.py",
 line 21, in bound_func
     return func(self, *args2, **kwargs2)
   File "/home/hirokiky/django/kydjango/tests/django/db/transaction.py",
 line 208, in inner
     return func(*args, **kwargs)
   File
 "/home/hirokiky/django/kydjango/tests/django/contrib/admin/options.py",
 line 1064, in change_view
     current_app=self.admin_site.name))
   File "/home/hirokiky/django/kydjango/tests/django/utils/decorators.py",
 line 25, in _wrapper
     return bound_func(*args, **kwargs)
   File "/home/hirokiky/django/kydjango/tests/django/utils/decorators.py",
 line 91, in _wrapped_view
     response = view_func(request, *args, **kwargs)
   File "/home/hirokiky/django/kydjango/tests/django/utils/decorators.py",
 line 21, in bound_func
     return func(self, *args2, **kwargs2)
   File "/home/hirokiky/django/kydjango/tests/django/db/transaction.py",
 line 208, in inner
     return func(*args, **kwargs)
   File
 "/home/hirokiky/django/kydjango/tests/django/contrib/admin/options.py",
 line 989, in add_view
     prefix=prefix, queryset=inline.queryset(request))
   File "/home/hirokiky/django/kydjango/tests/django/forms/models.py", line
 717, in __init__
     queryset=qs, **kwargs)
   File "/home/hirokiky/django/kydjango/tests/django/forms/models.py", line
 441, in __init__
     super(BaseModelFormSet, self).__init__(**defaults)
   File "/home/hirokiky/django/kydjango/tests/django/forms/formsets.py",
 line 53, in __init__
     self._construct_forms()
   File "/home/hirokiky/django/kydjango/tests/django/forms/formsets.py",
 line 122, in _construct_forms
     self.forms.append(self._construct_form(i))
   File "/home/hirokiky/django/kydjango/tests/django/forms/models.py", line
 730, in _construct_form
     form.data[form.add_prefix(self._pk_field.name)] = None
   File "/home/hirokiky/django/kydjango/tests/django/http/request.py", line
 304, in __setitem__
     self._assert_mutable()
   File "/home/hirokiky/django/kydjango/tests/django/http/request.py", line
 301, in _assert_mutable
     raise AttributeError("This QueryDict instance is immutable")
 AttributeError: This QueryDict instance is immutable

 }}}

 like this.

 One idea solving this is putting a line on a setting to avoid constructing
 request as immutable.
 And next step is solving these errors to handle request as immutable
 clearly.
 Finally, delete the avoiding setting.

 Any ideas?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17235#comment:4>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to