Commit bb4b6774 authored by Jérome Perrin's avatar Jérome Perrin

when fixing, don't set the property again if the cast failed.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9115 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent fd00128b
...@@ -85,12 +85,13 @@ class PropertyTypeValidity(Constraint): ...@@ -85,12 +85,13 @@ class PropertyTypeValidity(Constraint):
(property_id, property_type, str(type(value))) (property_id, property_type, str(type(value)))
if fixit: if fixit:
# try to cast to correct type # try to cast to correct type
if wrong_type : if wrong_type:
try : try:
value = self._type_dict[property_type][0](value) value = self._type_dict[property_type][0](value)
except (KeyError, ValueError), error: except (KeyError, ValueError), error:
error_message += " (Type cast failed : %s)" % error error_message += " (Type cast failed : %s)" % error
object.setProperty(property_id, value) else:
error_message += " (Fixed)" object.setProperty(property_id, value)
error_message += " (Fixed)"
errors.append(self._generateError(object, error_message)) errors.append(self._generateError(object, error_message))
return errors return errors
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment