-
Bug
-
Resolution: Invalid
-
Normal
-
None
-
None
-
None
When value for 'identifiers' is null in put json data, the TypeError exception is returned.
ERROR: test_put (tests.test_edition.TestEdition)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/stas/PycharmProjects/bookbrainz-ws/tests/test_edition.py", line 113, in test_put
self.put_tests()
File "/home/stas/PycharmProjects/bookbrainz-ws/tests/put_testing.py", line 52, in put_tests
self.put_good_test()
File "/home/stas/PycharmProjects/bookbrainz-ws/tests/put_testing.py", line 85, in put_good_test
self.make_put_request(entity, data_to_pass)
File "/home/stas/PycharmProjects/bookbrainz-ws/tests/put_testing.py", line 73, in make_put_request
data=json.dumps(data_to_pass))
File "/usr/local/lib/python2.7/dist-packages/werkzeug/test.py", line 798, in put
return self.open(*args, **kw)
File "/usr/local/lib/python2.7/dist-packages/flask/testing.py", line 108, in open
follow_redirects=follow_redirects)
File "/usr/local/lib/python2.7/dist-packages/werkzeug/test.py", line 751, in open
response = self.run_wsgi_app(environ, buffered=buffered)
File "/usr/local/lib/python2.7/dist-packages/werkzeug/test.py", line 668, in run_wsgi_app
rv = run_wsgi_app(self.application, environ, buffered=buffered)
File "/usr/local/lib/python2.7/dist-packages/werkzeug/test.py", line 871, in run_wsgi_app
app_rv = app(environ, start_response)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1836, in _call_
return self.wsgi_app(environ, start_response)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/usr/local/lib/python2.7/dist-packages/flask_restful/_init_.py", line 271, in error_router
return original_handler(e)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python2.7/dist-packages/flask_restful/_init_.py", line 268, in error_router
return self.handle_error(e)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python2.7/dist-packages/flask_restful/_init_.py", line 271, in error_router
return original_handler(e)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python2.7/dist-packages/flask_restful/_init_.py", line 268, in error_router
return self.handle_error(e)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/local/lib/python2.7/dist-packages/flask_restful/_init_.py", line 477, in wrapper
resp = resource(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/flask/views.py", line 84, in view
return self.dispatch_request(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/flask_restful/_init_.py", line 587, in dispatch_request
resp = meth(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/flask_oauthlib/provider/oauth2.py", line 547, in decorated
return f(*args, **kwargs)
File "/home/stas/PycharmProjects/bookbrainz-ws/bbws/entity.py", line 125, in put
entity_data = entity_data.update(data, db.session)
File "/usr/local/lib/python2.7/dist-packages/bbschema/entity_data.py", line 821, in update
new_data = super(EditionData, self).update(data, session)
File "/usr/local/lib/python2.7/dist-packages/bbschema/entity_data.py", line 265, in update
update_identifiers(self.identifiers, data)
File "/usr/local/lib/python2.7/dist-packages/bbschema/entity.py", line 462, in update_identifiers
for identifier_id, identifier_json in revision_json['identifiers']:
TypeError: 'NoneType' object is not iterable
Note:
It could be easily solved by checking if 'identifiers' is null and not continuing if it really is.