Permalink
Browse files

Merge pull request #47 from ymage/master

Improve colander schema error message handling
  • Loading branch information...
2 parents e9d539f + 8dd745a commit d3b6bf12cb26700afe7a0d014eac5d8e9088805d @almet almet committed Apr 3, 2012
Showing with 5 additions and 5 deletions.
  1. +5 −5 cornice/validators.py
View
10 cornice/validators.py 100644 → 100755
@@ -34,14 +34,14 @@ def _validate_fields(location, data):
request.errors.add(location, attr.name,
"%s is missing" % attr.name)
else:
- if not attr.name in data:
- request.validated[attr.name] = attr.missing
- continue
try:
- deserialized = attr.deserialize(data[attr.name])
+ if not attr.name in data:
+ deserialized = attr.deserialize(None)
+ else:
+ deserialized = attr.deserialize(data[attr.name])
except Invalid, e:
# the struct is invalid
- request.errors.add(location, attr.name, e.msg)
+ request.errors.add(location, attr.name, e.asdict()[attr.name])
else:
request.validated[attr.name] = deserialized

0 comments on commit d3b6bf1

Please sign in to comment.