[Erp5-report] r14544 - in /erp5/trunk/products/ERP5Type: ./ Constraint/

nobody at svn.erp5.org nobody at svn.erp5.org
Tue May 22 16:30:00 CEST 2007


Author: jerome
Date: Tue May 22 16:30:00 2007
New Revision: 14544

URL: http://svn.erp5.org?rev=14544&view=rev
Log:
style changes on constraints related classes


Modified:
    erp5/trunk/products/ERP5Type/Base.py
    erp5/trunk/products/ERP5Type/ConsistencyMessage.py
    erp5/trunk/products/ERP5Type/Constraint/Constraint.py
    erp5/trunk/products/ERP5Type/ObjectMessage.py

Modified: erp5/trunk/products/ERP5Type/Base.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Base.py?rev=14544&r1=14543&r2=14544&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Base.py (original)
+++ erp5/trunk/products/ERP5Type/Base.py Tue May 22 16:30:00 2007
@@ -1060,7 +1060,7 @@
     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 @@
     """
     Check the constitency of objects.
 
-    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
-
-    constraint_list -- the list of constraint we have to check
+    For example we can check if every Organisation has at least one Address.
+
+    This method looks the constraints defined inside the propertySheets then
+    check each of them
+
     """
     error_list = self._checkConsistency(fixit = fixit)
     # We are looking inside all instances in constraints, then we check
@@ -2087,7 +2085,7 @@
       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

Modified: erp5/trunk/products/ERP5Type/ConsistencyMessage.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/ConsistencyMessage.py?rev=14544&r1=14543&r2=14544&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/ConsistencyMessage.py (original)
+++ erp5/trunk/products/ERP5Type/ConsistencyMessage.py Tue May 22 16:30:00 2007
@@ -68,4 +68,4 @@
     """
     pass
 
-allow_class(ConsistencyMessage)   
+allow_class(ConsistencyMessage)

Modified: erp5/trunk/products/ERP5Type/Constraint/Constraint.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Constraint/Constraint.py?rev=14544&r1=14543&r2=14544&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Constraint/Constraint.py (original)
+++ erp5/trunk/products/ERP5Type/Constraint/Constraint.py Tue May 22 16:30:00 2007
@@ -56,9 +56,12 @@
         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 @@
         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):

Modified: erp5/trunk/products/ERP5Type/ObjectMessage.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/ObjectMessage.py?rev=14544&r1=14543&r2=14544&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/ObjectMessage.py (original)
+++ erp5/trunk/products/ERP5Type/ObjectMessage.py Tue May 22 16:30:00 2007
@@ -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 @@
 
   def getObject(self):
      """
-     Get the Object 
+     Get the Object.
      """
      from Globals import get_request
      request = get_request()['PARENTS']
@@ -89,4 +88,4 @@
 
      return None
 
-allow_class(ObjectMessage)   
+allow_class(ObjectMessage)




More information about the Erp5-report mailing list