equal
deleted
inserted
replaced
192 attrtype = rschema.objects(entity.e_schema)[0].type |
192 attrtype = rschema.objects(entity.e_schema)[0].type |
193 # on checkbox or selection, the field may not be in params |
193 # on checkbox or selection, the field may not be in params |
194 # NOTE: raising ValidationError here is not a good solution because |
194 # NOTE: raising ValidationError here is not a good solution because |
195 # we can't gather all errors at once. Hopefully, the new 3.6.x |
195 # we can't gather all errors at once. Hopefully, the new 3.6.x |
196 # form handling will fix that |
196 # form handling will fix that |
197 if attrtype == 'Int': |
197 if value and attrtype == 'Int': |
198 try: |
198 try: |
199 value = int(value) |
199 value = int(value) |
200 except ValueError: |
200 except ValueError: |
201 raise ValidationError(entity.eid, |
201 raise ValidationError(entity.eid, |
202 {attr: self.req._("invalid integer value")}) |
202 {attr: self.req._("invalid integer value")}) |
203 elif attrtype == 'Float': |
203 elif value and attrtype == 'Float': |
204 try: |
204 try: |
205 value = float(value) |
205 value = float(value) |
206 except ValueError: |
206 except ValueError: |
207 raise ValidationError(entity.eid, |
207 raise ValidationError(entity.eid, |
208 {attr: self.req._("invalid float value")}) |
208 {attr: self.req._("invalid float value")}) |