[IMP] JSONDecodeError > ValueError

JSONDecodeError extends ValueError, and is not available in the Python
Standard Library.
This commit is contained in:
Leonardo Rochael Almeida
2015-09-28 10:53:53 +02:00
committed by Martin Trigaux
parent 60af7cac02
commit bf4b47c94d
+2 -2
View File
@@ -504,8 +504,8 @@ class JsonRequest(WebRequest):
# Read POST content or POST Form Data named "request"
try:
self.jsonrequest = simplejson.loads(request)
except simplejson.JSONDecodeError:
self.jsonrequest = json.loads(request)
except ValueError:
msg = 'Invalid JSON data: %r' % (request,)
_logger.info('%s: %s', self.httprequest.path, msg)
raise werkzeug.exceptions.BadRequest(msg)