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