(self, obj, fixit=False)
return []
Check the object's consistency
Check the object's consistency
Check the object s consistency
def _checkConsistency(self, obj, fixit=False):
    """
    Check the object's consistency
    """
    attribute_name = self.getConstraintAttributeName()

    error = self._checkPropertyConsistency(obj, attribute_name)
    if error:
      return [self._generateError(obj, self._getMessage(error),
        dict(property_id=attribute_name))]

    identical = True

    # The expected value of the attribute is a TALES Expression
    attribute_expected_value = self._getExpressionValue(
      obj, self.getConstraintAttributeValue())

    attribute_value = obj.getProperty(attribute_name)

    if isinstance(attribute_expected_value, (list, tuple)):
      # List type
      if len(attribute_value) != len(attribute_expected_value):
        identical = False
      else:
        for item in attribute_value:
          if item not in attribute_expected_value:
            identical = False
            break
    else:
      # Other primitive type
      identical = (attribute_expected_value == attribute_value)

    if not identical:
      # Generate error and fix it if required
      if fixit:
        obj._setProperty(attribute_name, attribute_expected_value)
        message_id = 'message_invalid_attribute_value_fixed'
      else:
        message_id = 'message_invalid_attribute_value'

      error = self._generateError(
        obj, self._getMessage(message_id),
        dict(attribute_name=attribute_name,
             current_value=attribute_value,
             expected_value=attribute_expected_value))

      return [error]

    return []
def _checkConsistency ( self , obj , fixit = False ) : attribute_name = self . getConstraintAttributeName ( ) error = self . _checkPropertyConsistency ( obj , attribute_name ) if error : return [ self . _generateError ( obj , self . _getMessage ( error ) , dict ( property_id = attribute_name ) ) ] identical = True # The expected value of the attribute is a TALES Expression attribute_expected_value = self . _getExpressionValue ( obj , self . getConstraintAttributeValue ( ) ) attribute_value = obj . getProperty ( attribute_name ) if isinstance ( attribute_expected_value , ( list , tuple ) ) : # List type if len ( attribute_value ) != len ( attribute_expected_value ) : identical = False else : for item in attribute_value : if item not in attribute_expected_value : identical = False break else : # Other primitive type identical = ( attribute_expected_value == attribute_value ) if not identical : # Generate error and fix it if required if fixit : obj . _setProperty ( attribute_name , attribute_expected_value ) message_id = 'message_invalid_attribute_value_fixed' else : message_id = 'message_invalid_attribute_value' error = self . _generateError ( obj , self . _getMessage ( message_id ) , dict ( attribute_name = attribute_name , current_value = attribute_value , expected_value = attribute_expected_value ) ) return [ error ] return [ ]