[api] Django restframework 3.3.x update will affect experiment queueing
In my installation with this version of rest framework, I can no longer queue a configured experiment (i.e., click on the "Save" button). Downgrading to 3.2.x makes it work again.
The error caught by the web UI is: Could not read request body
(experiments/api.py, line 137) which generates a 400 error.
After inspection, it seems the request is read before entering the our API function. Putting a traceback printout on django/http/request.py
read()
, shows me the following stack:
File "/Users/andre/Projects/beat/beat.web/eggs/Django-1.8.7-py2.7.egg/django/utils/autoreload.py", line 229, in wrapper
fn(*args, **kwargs)
File "/Users/andre/Projects/beat/beat.web/eggs/Django-1.8.7-py2.7.egg/django/core/management/commands/runserver.py", line 143, in inner_run
ipv6=self.use_ipv6, threading=threading)
File "/Users/andre/Projects/beat/beat.web/eggs/Django-1.8.7-py2.7.egg/django/core/servers/basehttp.py", line 201, in run
httpd.serve_forever()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 238, in serve_forever
self._handle_request_noblock()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock
self.process_request(request, client_address)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 321, in process_request
self.finish_request(request, client_address)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/Users/andre/Projects/beat/beat.web/eggs/Django-1.8.7-py2.7.egg/django/core/servers/basehttp.py", line 102, in __init__
super(WSGIRequestHandler, self).__init__(*args, **kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 655, in __init__
self.handle()
File "/Users/andre/Projects/beat/beat.web/eggs/Django-1.8.7-py2.7.egg/django/core/servers/basehttp.py", line 182, in handle
handler.run(self.server.get_app())
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "/Users/andre/Projects/beat/beat.web/eggs/Django-1.8.7-py2.7.egg/django/contrib/staticfiles/handlers.py", line 63, in __call__
return self.application(environ, start_response)
File "/Users/andre/Projects/beat/beat.web/eggs/Django-1.8.7-py2.7.egg/django/core/handlers/wsgi.py", line 189, in __call__
response = self.get_response(request)
File "/Users/andre/Projects/beat/beat.web/eggs/Django-1.8.7-py2.7.egg/django/core/handlers/base.py", line 132, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/andre/Projects/beat/beat.web/eggs/Django-1.8.7-py2.7.egg/django/views/decorators/csrf.py", line 58, in wrapped_view
return view_func(*args, **kwargs)
File "/Users/andre/Projects/beat/beat.web/eggs/Django-1.8.7-py2.7.egg/django/views/generic/base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "/Users/andre/Projects/beat/beat.web/eggs/djangorestframework-3.3.1-py2.7.egg/rest_framework/views.py", line 454, in dispatch
self.initial(request, *args, **kwargs)
File "/Users/andre/Projects/beat/beat.web/eggs/djangorestframework-3.3.1-py2.7.egg/rest_framework/views.py", line 376, in initial
self.perform_authentication(request)
File "/Users/andre/Projects/beat/beat.web/eggs/djangorestframework-3.3.1-py2.7.egg/rest_framework/views.py", line 310, in perform_authentication
request.user
File "/Users/andre/Projects/beat/beat.web/eggs/djangorestframework-3.3.1-py2.7.egg/rest_framework/request.py", line 353, in __getattribute__
return super(Request, self).__getattribute__(attr)
File "/Users/andre/Projects/beat/beat.web/eggs/djangorestframework-3.3.1-py2.7.egg/rest_framework/request.py", line 193, in user
self._authenticate()
File "/Users/andre/Projects/beat/beat.web/eggs/djangorestframework-3.3.1-py2.7.egg/rest_framework/request.py", line 316, in _authenticate
user_auth_tuple = authenticator.authenticate(self)
File "/Users/andre/Projects/beat/beat.web/eggs/djangorestframework-3.3.1-py2.7.egg/rest_framework/authentication.py", line 127, in authenticate
self.enforce_csrf(request)
File "/Users/andre/Projects/beat/beat.web/eggs/djangorestframework-3.3.1-py2.7.egg/rest_framework/authentication.py", line 136, in enforce_csrf
reason = CSRFCheck().process_view(request, None, (), {})
File "/Users/andre/Projects/beat/beat.web/eggs/Django-1.8.7-py2.7.egg/django/middleware/csrf.py", line 174, in process_view
request_csrf_token = request.POST.get('csrfmiddlewaretoken', '')
File "/Users/andre/Projects/beat/beat.web/eggs/djangorestframework-3.3.1-py2.7.egg/rest_framework/request.py", line 353, in __getattribute__
return super(Request, self).__getattribute__(attr)
File "/Users/andre/Projects/beat/beat.web/eggs/djangorestframework-3.3.1-py2.7.egg/rest_framework/request.py", line 372, in POST
self._load_data_and_files()
File "/Users/andre/Projects/beat/beat.web/eggs/djangorestframework-3.3.1-py2.7.egg/rest_framework/request.py", line 243, in _load_data_and_files
self._data, self._files = self._parse()
File "/Users/andre/Projects/beat/beat.web/eggs/djangorestframework-3.3.1-py2.7.egg/rest_framework/request.py", line 289, in _parse
parsed = parser.parse(stream, media_type, self.parser_context)
File "/Users/andre/Projects/beat/beat.web/eggs/djangorestframework-3.3.1-py2.7.egg/rest_framework/parsers.py", line 66, in parse
data = stream.read().decode(encoding)
File "/Users/andre/Projects/beat/beat.web/eggs/Django-1.8.7-py2.7.egg/django/http/request.py", line 290, in read
import traceback; traceback.print_stack()
[13/Dec/2015 10:30:44] "POST /api/v1/experiments/anjos/ HTTP/1.1" 400 29