Merge pull request #193 from colinhowe/dev
Improved Validation warnings - Thanks Colin Howe
This commit is contained in:
commit
e518c51de3
@ -628,8 +628,8 @@ class BaseDocument(object):
|
|||||||
try:
|
try:
|
||||||
field._validate(value)
|
field._validate(value)
|
||||||
except (ValueError, AttributeError, AssertionError), e:
|
except (ValueError, AttributeError, AssertionError), e:
|
||||||
raise ValidationError('Invalid value for field of type "%s": %s'
|
raise ValidationError('Invalid value for field named "%s" of type "%s": %s'
|
||||||
% (field.__class__.__name__, value))
|
% (field.name, field.__class__.__name__, value))
|
||||||
elif field.required:
|
elif field.required:
|
||||||
raise ValidationError('Field "%s" is required' % field.name)
|
raise ValidationError('Field "%s" is required' % field.name)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user