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

style changes on constraints related classes



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14544 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b3a221d4
...@@ -1060,7 +1060,7 @@ class Base( CopyContainer, ...@@ -1060,7 +1060,7 @@ class Base( CopyContainer,
else: else:
# Check in local properties (which obviously were defined at some point) # Check in local properties (which obviously were defined at some point)
for p_id in self.propertyIds(): for p_id in self.propertyIds():
if key==p_id: if key == p_id:
return 1 return 1
return 0 return 0
...@@ -2069,13 +2069,11 @@ class Base( CopyContainer, ...@@ -2069,13 +2069,11 @@ class Base( CopyContainer,
""" """
Check the constitency of objects. Check the constitency of objects.
For example we can check if every Organisation has at least For example we can check if every Organisation has at least one Address.
one Address.
This method looks the constraints defines inside the propertySheets This method looks the constraints defined inside the propertySheets then
then check each of them check each of them
constraint_list -- the list of constraint we have to check
""" """
error_list = self._checkConsistency(fixit = fixit) error_list = self._checkConsistency(fixit = fixit)
# We are looking inside all instances in constraints, then we check # We are looking inside all instances in constraints, then we check
...@@ -2087,7 +2085,7 @@ class Base( CopyContainer, ...@@ -2087,7 +2085,7 @@ class Base( CopyContainer,
else: else:
error_list += constraint_instance.checkConsistency(self) error_list += constraint_instance.checkConsistency(self)
if len(error_list) > 0 and fixit: if fixit and len(error_list) > 0:
self.reindexObject() self.reindexObject()
return error_list return error_list
......
...@@ -56,9 +56,12 @@ class Constraint: ...@@ -56,9 +56,12 @@ class Constraint:
Remove unwanted attributes from constraint definition and keep Remove unwanted attributes from constraint definition and keep
them as instance attributes them as instance attributes
""" """
if id is not None: self.id = id if id is not None:
if description is not None: self.description = description self.id = id
if type is not None: self.type = type if description is not None:
self.description = description
if type is not None:
self.type = type
self.constraint_definition.update(constraint_definition) self.constraint_definition.update(constraint_definition)
def _generateError(self, obj, error_message, mapping={}): def _generateError(self, obj, error_message, mapping={}):
...@@ -66,7 +69,8 @@ class Constraint: ...@@ -66,7 +69,8 @@ class Constraint:
Generic method used to generate error in checkConsistency. Generic method used to generate error in checkConsistency.
""" """
if error_message is not None: if error_message is not None:
msg = ConsistencyMessage(self, obj.getRelativeUrl(), error_message, mapping) msg = ConsistencyMessage(self, obj.getRelativeUrl(),
error_message, mapping)
return msg return msg
def _checkConstraintCondition(self, obj): def _checkConstraintCondition(self, obj):
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
# #
############################################################################## ##############################################################################
from Products.CMFCore.utils import getToolByName
from Products.PythonScripts.Utility import allow_class from Products.PythonScripts.Utility import allow_class
class ObjectMessage: class ObjectMessage:
...@@ -78,7 +77,7 @@ class ObjectMessage: ...@@ -78,7 +77,7 @@ class ObjectMessage:
def getObject(self): def getObject(self):
""" """
Get the Object Get the Object.
""" """
from Globals import get_request from Globals import get_request
request = get_request()['PARENTS'] request = get_request()['PARENTS']
......
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