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):
(property_id, property_type, str(type(value)))
if fixit:
# try to cast to correct type
if wrong_type :
try :
if wrong_type:
try:
value = self._type_dict[property_type][0](value)
except (KeyError, ValueError), error:
error_message += " (Type cast failed : %s)" % error
object.setProperty(property_id, value)
error_message += " (Fixed)"
else:
object.setProperty(property_id, value)
error_message += " (Fixed)"
errors.append(self._generateError(object, error_message))
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