FileField's values are now optional. When no value is applied, no File object is created and referenced.

This commit is contained in:
Florian Schlachter
2010-07-20 22:46:00 +02:00
parent 03c0fd9ada
commit aa00feb6a5
2 changed files with 11 additions and 6 deletions

View File

@@ -339,8 +339,8 @@ class BaseDocument(object):
try:
field._validate(value)
except (ValueError, AttributeError, AssertionError), e:
raise ValidationError('Invalid value for field of type "' +
field.__class__.__name__ + '"')
raise ValidationError('Invalid value for field of type "%s": %s'
% (field.__class__.__name__, value))
elif field.required:
raise ValidationError('Field "%s" is required' % field.name)