--- a/web/views/editcontroller.py Thu Sep 10 08:13:22 2009 +0200
+++ b/web/views/editcontroller.py Fri Sep 11 15:57:34 2009 +0200
@@ -194,19 +194,7 @@
# NOTE: raising ValidationError here is not a good solution because
# we can't gather all errors at once. Hopefully, the new 3.6.x
# form handling will fix that
- if value and attrtype == 'Int':
- try:
- value = int(value)
- except ValueError:
- raise ValidationError(entity.eid,
- {attr: self.req._("invalid integer value")})
- elif value and attrtype == 'Float':
- try:
- value = float(value)
- except ValueError:
- raise ValidationError(entity.eid,
- {attr: self.req._("invalid float value")})
- elif attrtype == 'Boolean':
+ if attrtype == 'Boolean':
value = bool(value)
elif attrtype == 'Decimal':
value = Decimal(value)
@@ -248,6 +236,18 @@
# no specified value, skip
return
elif value is not None:
+ if attrtype == 'Int':
+ try:
+ value = int(value)
+ except ValueError:
+ raise ValidationError(entity.eid,
+ {attr: self.req._("invalid integer value")})
+ elif attrtype == 'Float':
+ try:
+ value = float(value)
+ except ValueError:
+ raise ValidationError(entity.eid,
+ {attr: self.req._("invalid float value")})
if attrtype in ('Date', 'Datetime', 'Time'):
try:
value = self.parse_datetime(value, attrtype)