Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server crashes if data comes in as a dictionary instead of floating point value. #61

Open
ssfrr opened this issue May 19, 2015 · 0 comments

Comments

@ssfrr
Copy link
Member

ssfrr commented May 19, 2015

Should send back a failure to the client.

Traceback (most recent call last):

  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 114, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)

  File "/usr/local/lib/python2.7/dist-packages/django/views/decorators/csrf.py", line 57, in wrapped_view
    return view_func(*args, **kwargs)

  File "/home/sfr/chain-api/chain/core/api.py", line 748, in create_view
    return cls.create_single(data, request)

  File "/home/sfr/chain-api/chain/core/api.py", line 755, in create_single
    new_resource.save()

  File "/home/sfr/chain-api/chain/core/api.py", line 544, in save
    self.deserialize()

  File "/home/sfr/chain-api/chain/core/api.py", line 495, in deserialize
    self._data[field_name])

  File "/home/sfr/chain-api/chain/core/api.py", line 476, in sanitize_field_value
    return field.to_python(value)

  File "/usr/local/lib/python2.7/dist-packages/django/db/models/fields/__init__.py", line 1055, in to_python
    params={'value': value},

ValidationError: [u"'{u'power_good': True, u'charging': False}' value must be a float."]


<WSGIRequest
path:/scalar_data/create,
GET:<QueryDict: {u'sensor_id': [u'2763']}>,
POST:<QueryDict: {}>,
COOKIES:{},
META:{'CONTENT_LENGTH': '99',
 u'CSRF_COOKIE': u'eaEEB0wRmMcpPo8dTVZvMKObdFPvyhZn',
 'HTTP_ACCEPT': '*/*',
 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
 'HTTP_AUTHORIZATION': 'Basic Y2hhaW5jb2xsZWN0b3JzOlY4VGlPRTZ5VndwaklpbTEzeWJoakE5Tw==',
 'HTTP_CONNECTION': 'close',
 'HTTP_HOST': 'chain-api.media.mit.edu',
 'HTTP_USER_AGENT': 'python-requests/2.3.0 CPython/2.7.3 Linux/3.11.0-26-generic',
 'HTTP_X_FORWARDED_FOR': '18.85.58.252',
 'PATH_INFO': u'/scalar_data/create',
 'QUERY_STRING': 'sensor_id=2763',
 'RAW_URI': '/scalar_data/create?sensor_id=2763',
 'REMOTE_ADDR': '18.85.58.252',
 'REMOTE_PORT': '80',
 'REQUEST_METHOD': 'POST',
 'SCRIPT_NAME': u'',
 'SERVER_NAME': 'chain-api.media.mit.edu',
 'SERVER_PORT': '80',
 'SERVER_PROTOCOL': 'HTTP/1.0',
 'SERVER_SOFTWARE': 'gunicorn/18.0',
 'gunicorn.socket': <socket._socketobject object at 0x294a520>,
 'wsgi.errors': <open file '<stderr>', mode 'w' at 0x7fd4a1bc9270>,
 'wsgi.file_wrapper': <class gunicorn.http.wsgi.FileWrapper at 0x1842668>,
 'wsgi.input': <gunicorn.http.body.Body object at 0x2afd950>,
 'wsgi.multiprocess': True,
 'wsgi.multithread': False,
 'wsgi.run_once': False,
 'wsgi.url_scheme': 'http',
 'wsgi.version': (1, 0)}>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant