[Erp5-report] r14879 - /erp5/trunk/products/ERP5Form/PlanningBox.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Jun 19 16:35:40 CEST 2007


Author: romain
Date: Tue Jun 19 16:35:40 2007
New Revision: 14879

URL: http://svn.erp5.org?rev=14879&view=rev
Log:
Writing in the widget when rendering the field is a really bad idea.
So, do not use build_error_list anymore, and raise a real Error instead.

Modified:
    erp5/trunk/products/ERP5Form/PlanningBox.py

Modified: erp5/trunk/products/ERP5Form/PlanningBox.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/PlanningBox.py?rev=14879&r1=14878&r2=14879&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/PlanningBox.py (original)
+++ erp5/trunk/products/ERP5Form/PlanningBox.py Tue Jun 19 16:35:40 2007
@@ -62,6 +62,9 @@
 from Products.CMFCore.utils import getToolByName
 from Products.ERP5Type.Utils import getPath
 from Products.ERP5Type.Message import Message
+
+class PlanningBoxError(Exception):
+  pass
 
 class PlanningBoxValidator(Validator.StringBaseValidator):
   """
@@ -521,9 +524,8 @@
     value will not be updated (as the block was not on the real activity bound)
     """
     # getting list moved block names
-    block_moved_name_list = map(lambda x: x['block_moved']['name'],
-                                activity_block_moved_list)
-
+    block_moved_name_list = [x['block_moved']['name'] for x in activity_block_moved_list]
+    
     for activity_block in activity_block_list:
       if activity_block.name in block_moved_name_list:
         # the block composing the activity has been moved, not taking care of
@@ -915,6 +917,7 @@
     # build structure
     # render_structure will call all method necessary to build the entire
     # structure relative to the planning
+    # XXX Conflict error
     # creates and fill up self.basic, self.planning and self.build_error_list
     self.render_structure(field=field, key=key, value=value,
                           REQUEST=REQUEST, here=here)
@@ -958,8 +961,6 @@
     # XXX testing : uncoment to put selection to null => used for debugging
     #here.portal_selections.setSelectionFor(selection_name, None)
     ####### DATA DEFINITION #######
-    # XXX Conflict error
-    self.build_error_list = None
     # recovering usefull planning properties
     # getting form
     form = field.aq_parent
@@ -1002,8 +1003,7 @@
     # call build method to generate BasicStructure
     status = self.basic.build()
     if status != 1:
-      # XXX Conflict error
-      self.build_error_list = status
+      raise PlanningBoxError, status
       return self
 
     ###### CALL CLASS METHODS TO BUILD PLANNING STRUCTURE ######
@@ -1015,8 +1015,7 @@
                                  REQUEST=REQUEST)
     if status != 1:
       # in case error during planning structure generation
-      # XXX Conflict error
-      self.build_error_list = status
+      raise PlanningBoxError, status
       return self
 
     return self




More information about the Erp5-report mailing list