muccg / rdrf

The Rare Disease Registry Framework (RDRF) is an open source tool for the creation of web-based patient registries.
GNU Affero General Public License v3.0
15 stars 8 forks source link

AttributeError: This QueryDict instance is immutable #731

Closed aminur80 closed 5 years ago

aminur80 commented 5 years ago

under the fh registry - -Create a new patient

It gives the error - AttributeError: This QueryDict instance is immutable

File "/app/rdrf/rdrf/views/form_view.py", line 506, in post runserver_1 | request.POST.update(request.FILES)

id2359 commented 5 years ago

This may be relevant: https://stackoverflow.com/questions/12611345/django-why-is-the-request-post-object-immutable

id2359 commented 5 years ago

Stack trace

builtins.AttributeError
AttributeError: This QueryDict instance is immutable

Traceback (most recent call last)
File "/env/lib/python3.6/site-packages/django/contrib/staticfiles/handlers.py", line 65, in __call__
return self.application(environ, start_response)
File "/env/lib/python3.6/site-packages/django/core/handlers/wsgi.py", line 142, in __call__
response = self.get_response(request)
File "/env/lib/python3.6/site-packages/django/core/handlers/base.py", line 78, in get_response
response = self._middleware_chain(request)
File "/env/lib/python3.6/site-packages/django/core/handlers/exception.py", line 36, in inner
response = response_for_exception(request, exc)
File "/env/lib/python3.6/site-packages/django/core/handlers/exception.py", line 90, in response_for_exception
response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
File "/env/lib/python3.6/site-packages/django/core/handlers/exception.py", line 125, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File "/env/lib/python3.6/site-packages/django_extensions/management/technical_response.py", line 37, in null_technical_500_response
six.reraise(exc_type, exc_value, tb)
File "/env/lib/python3.6/site-packages/six.py", line 692, in reraise
raise value.with_traceback(tb)
File "/env/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/env/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/env/lib/python3.6/site-packages/django/core/handlers/base.py", line 124, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/env/lib/python3.6/site-packages/django/views/generic/base.py", line 68, in view
return self.dispatch(request, *args, **kwargs)
File "/env/lib/python3.6/site-packages/django/views/generic/base.py", line 88, in dispatch
return handler(request, *args, **kwargs)
File "/env/lib/python3.6/site-packages/django/utils/decorators.py", line 45, in _wrapper
return bound_method(*args, **kwargs)
File "/env/lib/python3.6/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
return view_func(request, *args, **kwargs)
File "/app/rdrf/rdrf/views/form_view.py", line 506, in post
request.POST.update(request.FILES)
File "/env/lib/python3.6/site-packages/django/utils/datastructures.py", line 201, in update
self.setlistdefault(key).extend(value_list)
File "/env/lib/python3.6/site-packages/django/http/request.py", line 468, in setlistdefault
self._assert_mutable()
File "/env/lib/python3.6/site-packages/django/http/request.py", line 436, in _assert_mutable
raise AttributeError("This QueryDict instance is immutable")
AttributeError: This QueryDict instance is immutable
The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.
To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.

You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:

dump() shows all variables in the frame
dump(obj) dumps all that's known about the object
Brought to you by DON'T PANIC, your friendly Werkzeug powered traceback interpreter.
id2359 commented 5 years ago

Fixed by copying

post_copy = request.POST.copy()

Need to check / test further

id2359 commented 5 years ago

fixed in django upgrade branch