[Erp5-report] r17173 - /erp5/trunk/products/ERP5Type/Constraint/StringAttributeMatch.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Oct 24 17:01:25 CEST 2007
Author: romain
Date: Wed Oct 24 17:01:25 2007
New Revision: 17173
URL: http://svn.erp5.org?rev=17173&view=rev
Log:
Do not test attribute if it's not defined.
Modified:
erp5/trunk/products/ERP5Type/Constraint/StringAttributeMatch.py
Modified: erp5/trunk/products/ERP5Type/Constraint/StringAttributeMatch.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Constraint/StringAttributeMatch.py?rev=17173&r1=17172&r2=17173&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Constraint/StringAttributeMatch.py (original)
+++ erp5/trunk/products/ERP5Type/Constraint/StringAttributeMatch.py Wed Oct 24 17:01:25 2007
@@ -48,18 +48,19 @@
Check that each attribute does not match the RE
"""
errors = PropertyExistence.checkConsistency(self, object, fixit=fixit)
- for attribute_name, attribute_value in self.constraint_definition.items():
- error_message = None
- # If property does not exist, error will be raise by
- # PropertyExistence Constraint.
- current_value = object.getProperty(attribute_name)
- regexp = re.compile(attribute_value)
- if (current_value is not None) and \
- (regexp.match(current_value) is None):
- # Generate error_message
- error_message = "Attribute %s is '%s' and not match '%s'" % \
- (attribute_name, current_value,
- attribute_value)
- # Generate error
- errors.append(self._generateError(object, error_message))
+ if not errors:
+ for attribute_name, attribute_value in self.constraint_definition.items():
+ error_message = None
+ # If property does not exist, error will be raise by
+ # PropertyExistence Constraint.
+ current_value = object.getProperty(attribute_name)
+ regexp = re.compile(attribute_value)
+ if (current_value is not None) and \
+ (regexp.match(current_value) is None):
+ # Generate error_message
+ error_message = "Attribute %s is '%s' and not match '%s'" % \
+ (attribute_name, current_value,
+ attribute_value)
+ # Generate error
+ errors.append(self._generateError(object, error_message))
return errors
More information about the Erp5-report
mailing list