Error clean up, error catching, require django <1.9
* cleaning up the error format in this function to match our standard format. * Catching an error that can occur if the json is improperly decoded. * fixing Django to the LTS support version as 1.9.1 breaks our automatic api documentation. Change-Id: Ib3e452427989b376c55710ce33f73fabdc84260d
This commit is contained in:
parent
b76c3af1f6
commit
e8ff4a1c40
@ -1,4 +1,4 @@
|
||||
Django>=1.8.9
|
||||
Django>=1.8.9,<1.9
|
||||
decorator>=3.4.0
|
||||
djangorestframework>=3.0.3
|
||||
keystonemiddleware>=1.3.1
|
||||
|
@ -684,9 +684,13 @@ class TokenDetail(APIViewWithLogger):
|
||||
data[field] = request.data[field]
|
||||
except KeyError:
|
||||
errors[field] = ["This field is required.", ]
|
||||
except TypeError:
|
||||
errors = ["Improperly formated json. " +
|
||||
"Should be a key-value object.", ]
|
||||
break
|
||||
|
||||
if errors:
|
||||
return Response(errors, status=400)
|
||||
return Response({"errors": errors}, status=400)
|
||||
|
||||
for action in actions:
|
||||
try:
|
||||
|
Loading…
x
Reference in New Issue
Block a user