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

Documentation fixes, "This is the check method, we return a list of string,

each string corresponds to an error" was wrong, constraints returns some
ConsistencyMessage instances



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21030 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 128682f6
......@@ -51,9 +51,7 @@ class AttributeEquality(PropertyExistence):
"value is ${current_value} but should be ${expected_value} (Fixed)"
def checkConsistency(self, obj, fixit=0):
"""
This is the check method, we return a list of string,
each string corresponds to an error.
"""Check the object's consistency.
We will make sure that each non None constraint_definition is
satisfied (equality)
"""
......
......@@ -33,10 +33,10 @@ from Products.ERP5Type.Constraint.CategoryMembershipArity \
class CategoryAcquiredMembershipArity(CategoryMembershipArity):
"""
This method check and fix if an object respects the arity.
For example we can check if every Order has at
least one source.
Configuration exemple:
This method checks if an object respects the arity.
For example we can check if every Order has at least one source.
Configuration example:
{ 'id' : 'source',
'description' : '',
'type' : 'CategoryAcquiredMembershipArity',
......
......@@ -56,9 +56,7 @@ class CategoryExistence(Constraint):
portal_type=portal_type))
def checkConsistency(self, obj, fixit=0):
"""
This is the check method, we return a list of string,
each string corresponds to an error.
"""Check the object's consistency.
"""
if not self._checkConstraintCondition(obj):
return []
......@@ -85,8 +83,8 @@ class CategoryExistence(Constraint):
class CategoryAcquiredExistence(CategoryExistence):
"""This constraint check an object respects the existence of a category, with
acquisition.
"""This constraint checks if an object respects the existence of a category,
with acquisition.
Configuration example:
{ 'id' : 'category_existence',
......
......@@ -31,9 +31,9 @@ from Constraint import Constraint
class CategoryMembershipArity(Constraint):
"""
This method check and fix if an object respects the arity.
For example we can check if every Order has at
least one source.
This constraint checks if an object respects the arity.
For example we can check if every Order has at least one source.
Configuration exemple:
{ 'id' : 'source',
'description' : '',
......@@ -45,6 +45,7 @@ class CategoryMembershipArity(Constraint):
'condition' : 'python: object.getPortalType() == 'Foo',
},
"""
_message_id_list = ['message_arity_too_small',
'message_arity_not_in_range',
'message_arity_with_portal_type_to_small',
......@@ -73,9 +74,7 @@ class CategoryMembershipArity(Constraint):
portal_type=portal_type))
def checkConsistency(self, obj, fixit=0):
"""
This is the check method, we return a list of string,
each string corresponds to an error.
"""Check the object's consistency.
We are looking the definition of the constraing where
are defined the minimum and the maximum arity, and the
list of objects we wants to check the arity.
......
......@@ -51,12 +51,7 @@ class CategoryMembershipState(Constraint):
"which is not in ${valid_state_list}"
def checkConsistency(self, obj, fixit=0):
"""
This is the check method, we return a list of string,
each string corresponds to an error.
We are looking the definition of the constraing where
are defined the minimum and the maximum arity, and the
list of objects we wants to check the arity.
"""Check the object's consistency.
"""
if not self._checkConstraintCondition(obj):
return []
......@@ -64,7 +59,7 @@ class CategoryMembershipState(Constraint):
# Retrieve values inside de PropertySheet (_constraints)
base_category = self.constraint_definition['base_category']
portal_type = self.constraint_definition['portal_type']
membership_list = obj.getValueList(base_category,
membership_list = obj.getValueList(base_category,
portal_type=portal_type)
state_var_list = self.constraint_definition.copy()
state_var_list.pop('portal_type')
......
......@@ -33,8 +33,9 @@ from Products.ERP5Type.Constraint.CategoryMembershipArity \
class CategoryRelatedMembershipArity(CategoryMembershipArity):
"""
This method check and fix if an object respects the arity
from a category reverse membership point of view.
This method checks if an object respects the arity from a category reverse
membership point of view.
For example we can check if every Order has at
most one Order Applied Rule.
Configuration example:
......
......@@ -61,9 +61,7 @@ class PortalTypeClass(Constraint):
" document class is ${document_class}"
def checkConsistency(self, obj, fixit=0):
"""
This is the check method, we return a list of string,
each string corresponds to an error.
"""Check the object's consistency.
"""
if not self._checkConstraintCondition(obj):
return []
......
......@@ -31,8 +31,8 @@ from Constraint import Constraint
class PropertyExistence(Constraint):
"""
This method check and fix if an object respects the existence of a
property.
This method checks if an object respects the existence of a property.
For example we can check if every invoice line has a price defined
on it.
Configuration example:
......@@ -52,9 +52,7 @@ class PropertyExistence(Constraint):
"${property_id}, this property is not defined"
def checkConsistency(self, obj, fixit=0):
"""
This is the check method, we return a list of string,
each string corresponds to an error.
"""Check the object's consistency.
"""
if not self._checkConstraintCondition(obj):
return []
......
......@@ -79,9 +79,7 @@ class PropertyTypeValidity(Constraint):
def checkConsistency(self, obj, fixit=0):
"""
This is the check method, we return a list of string,
each string corresponds to an error.
"""Check the object's consistency.
"""
error_list = []
# For each attribute name, we check type
......
......@@ -31,9 +31,9 @@ from Products.ERP5Type.Constraint.PropertyExistence import PropertyExistence
class StringAttributeMatch(PropertyExistence):
"""
This constraint class allows to check
that a string property match a regular
expression. Configuration example:
This constraint class allows to check that a string property matches a
regular expression.
Configuration example:
{ 'id' : 'title_not_empty',
'description' : 'Title must be defined',
'type' : 'StringAttributeMatch',
......@@ -48,10 +48,8 @@ class StringAttributeMatch(PropertyExistence):
"${attribute_value} and does not match ${regular_expression}."
def checkConsistency(self, object, fixit=0):
"""
This is the check method, we return a list of string,
each string corresponds to an error.
Check that each attribute does not match the RE
"""Check the object's consistency.
Check that each attribute matches the regular expression.
"""
error_list = PropertyExistence.checkConsistency(
self, object, fixit=fixit)
......
......@@ -59,7 +59,8 @@ class TALESConstraint(Constraint):
"Error while evaluating expression: ${error_text}"
def checkConsistency(self, obj, fixit=0):
"""See Interface """
"""Check the object's consistency.
"""
# import this later to prevent circular import
from Products.ERP5Type.Utils import createExpressionContext
if not self._checkConstraintCondition(obj):
......
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