[Erp5-report] r33857 nicolas - /erp5/trunk/products/ERP5/Document/BusinessTemplate.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Mar 18 12:10:44 CET 2010


Author: nicolas
Date: Thu Mar 18 12:10:43 2010
New Revision: 33857

URL: http://svn.erp5.org?rev=33857&view=rev
Log:
* Move recursive_path_list filling after installation because some objects 
may have been deleted.
* Check that objectIds() is supported on object before calling it.

Modified:
    erp5/trunk/products/ERP5/Document/BusinessTemplate.py

Modified: erp5/trunk/products/ERP5/Document/BusinessTemplate.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/BusinessTemplate.py?rev=33857&r1=33856&r2=33857&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BusinessTemplate.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/BusinessTemplate.py [utf8] Thu Mar 18 12:10:43 2010
@@ -903,16 +903,6 @@
       groups = {}
       old_groups = {}
       portal = context.getPortalObject()
-      # Fetch all sub objects path recursively
-      recursive_path_list = []
-      def fillRecursivePathList(from_path_list):
-        for from_path in from_path_list:
-          container = portal.unrestrictedTraverse(from_path, None)
-          if container is not None:
-            recursive_path_list.append(from_path)
-            fillRecursivePathList(['%s/%s' % (from_path, sub_content_id) for\
-                                      sub_content_id in container.objectIds()])
-      fillRecursivePathList(self._objects.keys())
       # sort to add objects before their subobjects
       keys = self._objects.keys()
       keys.sort()
@@ -1129,6 +1119,18 @@
       # restore previous activities execution order
       context.setPlacelessDefaultReindexParameters(**original_reindex_parameters)
       # Do not forget to delete all remaining objects if asked by user
+      # Fetch all sub objects path recursively
+      recursive_path_list = []
+      def fillRecursivePathList(from_path_list):
+        for from_path in from_path_list:
+          container = portal.unrestrictedTraverse(from_path, None)
+          if container is not None:
+            recursive_path_list.append(from_path)
+            # Check that container support iteration of sub_content_id
+            if getattr(aq_base(container), 'objectIds', None) is not None:
+              fillRecursivePathList(['%s/%s' % (from_path, sub_content_id) for\
+                                        sub_content_id in container.objectIds()])
+      fillRecursivePathList(self._objects.keys())
       for recursive_path in recursive_path_list:
         if recursive_path in update_dict:
           action = update_dict[recursive_path]




More information about the Erp5-report mailing list