[Erp5-report] r36804 tatuya - /erp5/trunk/products/ERP5/Document/BusinessTemplate.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Jul 2 13:11:12 CEST 2010


Author: tatuya
Date: Fri Jul  2 13:11:11 2010
New Revision: 36804

URL: http://svn.erp5.org?rev=36804&view=rev
Log:
Fix a issue that BusinessTemplate wrongly removes the sub directory skins of another business template when upgrading. To fix the issue, it is stopped to remove the sub directory when the parent is removing.

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=36804&r1=36803&r2=36804&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BusinessTemplate.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/BusinessTemplate.py [utf8] Fri Jul  2 13:11:11 2010
@@ -1159,9 +1159,10 @@ class ObjectTemplateItem(BaseTemplateIte
                                         sub_content_id in container.objectIds()])
       fillRecursivePathList(self._objects.keys())
       for recursive_path in recursive_path_list:
+        remove_action_tuple = ('remove', 'save_and_remove')
         if recursive_path in update_dict:
           action = update_dict[recursive_path]
-          if action in ('remove', 'save_and_remove'):
+          if action in remove_action_tuple:
             document = portal.restrictedTraverse(recursive_path, None)
             if document is None:
               # It happens if the parent of target path is removed before
@@ -1175,6 +1176,11 @@ class ObjectTemplateItem(BaseTemplateIte
             container_path_list = recursive_path.split('/')[:-1]
             self._backupObject(action, trashbin, container_path_list,
                                document_id)
+            container_path = os.path.dirname(recursive_path)
+            if container_path in update_dict and \
+              update_dict[container_path] in remove_action_tuple:
+              # If parent is removed, no need to remove the sub directory.
+              continue
             parent.manage_delObjects([document_id])
     else:
       # for old business template format
@@ -1225,6 +1231,12 @@ class ObjectTemplateItem(BaseTemplateIte
           unregisterSkinFolder(container, skin_folder,
               container.getSkinSelections())
 
+        remove_dict = kw.get('remove_object_dict', {})
+        container_path_name = os.path.dirname(relative_url)
+        if container_path_name in remove_dict and \
+          remove_dict[container_path_name] in ('remove', 'save_and_remove'):
+          # If parent is removed, no need to remove the sub directory.
+          continue
         container.manage_delObjects([object_id])
         if container.aq_parent.meta_type == 'ERP5 Catalog' and not len(container):
           # We are removing a ZSQLMethod, remove the SQLCatalog if empty




More information about the Erp5-report mailing list