diff --git a/product/ERP5Type/Base.py b/product/ERP5Type/Base.py index 71256b6e53f2583b0d28a8fbdf9b9f64d3d66234..c1318f1ee953ef30b909b2c0b15087f0f0f776d2 100644 --- a/product/ERP5Type/Base.py +++ b/product/ERP5Type/Base.py @@ -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 diff --git a/product/ERP5Type/ConsistencyMessage.py b/product/ERP5Type/ConsistencyMessage.py index 945bd12ca745314962380d80e317b6450df91a96..09384cf03cc7764acadcce34fa11f81d8b7a753d 100644 --- a/product/ERP5Type/ConsistencyMessage.py +++ b/product/ERP5Type/ConsistencyMessage.py @@ -68,4 +68,4 @@ class ConsistencyMessage(ObjectMessage): """ pass -allow_class(ConsistencyMessage) +allow_class(ConsistencyMessage) diff --git a/product/ERP5Type/Constraint/Constraint.py b/product/ERP5Type/Constraint/Constraint.py index b01f58b61280c856c51cfe5bea81a511daa5d62f..3447adffee082e3e7496de32cbbf5ce3d92f198b 100644 --- a/product/ERP5Type/Constraint/Constraint.py +++ b/product/ERP5Type/Constraint/Constraint.py @@ -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): diff --git a/product/ERP5Type/ObjectMessage.py b/product/ERP5Type/ObjectMessage.py index 855f6fce7b7616d54a1d89f9abee44541b66f0ab..34a01e80af5a9c336a6c61ff8d10d9e9d7e2fb2c 100644 --- a/product/ERP5Type/ObjectMessage.py +++ b/product/ERP5Type/ObjectMessage.py @@ -26,10 +26,9 @@ # ############################################################################## -from Products.CMFCore.utils import getToolByName from Products.PythonScripts.Utility import allow_class -class ObjectMessage: +class ObjectMessage: """ Object Message is used for notifications to user. """ @@ -78,7 +77,7 @@ class ObjectMessage: def getObject(self): """ - Get the Object + Get the Object. """ from Globals import get_request request = get_request()['PARENTS'] @@ -89,4 +88,4 @@ class ObjectMessage: return None -allow_class(ObjectMessage) +allow_class(ObjectMessage)