[Erp5-report] r19374 - in /erp5/trunk/products/ERP5: Document/ Tool/

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Feb 19 10:09:30 CET 2008


Author: vincent
Date: Tue Feb 19 10:09:30 2008
New Revision: 19374

URL: http://svn.erp5.org?rev=19374&view=rev
Log:
Remove LocalConfiguration and update all users. It was only used as an acquisition context and caused needless (because never used afterward) modification of persistent objects at business template installation. This should save some disk space and increase performances a bit.

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

Modified: erp5/trunk/products/ERP5/Document/BusinessTemplate.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/BusinessTemplate.py?rev=19374&r1=19373&r2=19374&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BusinessTemplate.py (original)
+++ erp5/trunk/products/ERP5/Document/BusinessTemplate.py Tue Feb 19 10:09:30 2008
@@ -4453,15 +4453,12 @@
               modified_object_list.update({path : ['New', item.__class__.__name__[:-12]]})
         return modified_object_list
 
-      # get the list of modified and new object
-      self.portal_templates.updateLocalConfiguration(self, **kw)
-      local_configuration = self.portal_templates.getLocalConfiguration(self)
       for item_name in self._item_name_list:
         new_item = getattr(self, item_name, None)
         old_item = getattr(installed_bt, item_name, None)
         if new_item is not None:
           if old_item is not None and hasattr(old_item, '_objects'):
-            modified_object = new_item.preinstall(context=local_configuration, installed_bt=old_item)
+            modified_object = new_item.preinstall(context=self, installed_bt=old_item)
             if len(modified_object) > 0:
               modified_object_list.update(modified_object)
           else:
@@ -4524,11 +4521,6 @@
             gen.setupWorkflow(site)
           return
 
-      # Update local dictionary containing all setup parameters
-      # This may include mappings
-      self.portal_templates.updateLocalConfiguration(self, **kw)
-      local_configuration = self.portal_templates.getLocalConfiguration(self)
-
       # always created a trash bin because we may to save object already present
       # but not in a previous business templates apart at creation of a new site
       if trash_tool is not None and (len(object_to_update) > 0 or len(self.portal_templates.objectIds()) > 1):
@@ -4541,7 +4533,7 @@
         for item_name in self._item_name_list:
           item = getattr(self, item_name, None)
           if item is not None:
-            item.install(local_configuration, force=force, object_to_update=object_to_update, trashbin=trashbin)
+            item.install(self, force=force, object_to_update=object_to_update, trashbin=trashbin)
 
       # update catalog if necessary
       if force and self.isCatalogUpdatable():
@@ -4571,7 +4563,7 @@
         for item_name in installed_bt._item_name_list:
           item = getattr(installed_bt, item_name, None)
           if item is not None:
-            item.remove(local_configuration, remove_object_dict=remove_object_dict, trashbin=trashbin)
+            item.remove(self, remove_object_dict=remove_object_dict, trashbin=trashbin)
 
 
       # update tools if necessary
@@ -4630,16 +4622,12 @@
         This is similar to uninstall, but different in that this does
         not remove all items.
       """
-      # Update local dictionary containing all setup parameters
-      # This may include mappings
-      self.portal_templates.updateLocalConfiguration(self, **kw)
-      local_configuration = self.portal_templates.getLocalConfiguration(self)
       # Trash everything
       for item_name in self._item_name_list[::-1]:
         item = getattr(self, item_name, None)
         if item is not None:
           item.trash(
-                local_configuration,
+                self,
                 getattr(new_bt, item_name))
 
     security.declareProtected(Permissions.ManagePortal, 'uninstall')
@@ -4647,16 +4635,12 @@
       """
         For uninstall based on paramaters provided in **kw
       """
-      # Update local dictionary containing all setup parameters
-      # This may include mappings
-      self.portal_templates.updateLocalConfiguration(self, **kw)
-      local_configuration = self.portal_templates.getLocalConfiguration(self)
       # Uninstall everything
       # Trash everything
       for item_name in self._item_name_list[::-1]:
         item = getattr(self, item_name, None)
         if item is not None:
-          item.uninstall(local_configuration)
+          item.uninstall(self)
       # It is better to clear cache because the uninstallation of a
       # template deletes many things from the portal.
       self.getPortalObject().portal_caches.clearAllCache()

Modified: erp5/trunk/products/ERP5/Tool/TemplateTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Tool/TemplateTool.py?rev=19374&r1=19373&r2=19374&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Tool/TemplateTool.py (original)
+++ erp5/trunk/products/ERP5/Tool/TemplateTool.py Tue Feb 19 10:09:30 2008
@@ -74,16 +74,6 @@
   """
   pass
 
-class LocalConfiguration(Implicit):
-  """
-    Contains local configuration information
-  """
-  def __init__(self, **kw):
-    self.__dict__.update(kw)
-
-  def update(self, **kw):
-    self.__dict__.update(kw)
-
 class TemplateTool (BaseTool):
     """
       TemplateTool manages Business Templates.
@@ -160,32 +150,6 @@
       """
       return "file://%s/" % pathname2url(
                   os.path.join(getConfiguration().instancehome, 'bt5'))
-
-    def updateLocalConfiguration(self, template, **kw):
-      """
-        Call the update method on the configuration, create if it doesn't
-        exists.
-      """
-      template_id = template.getId()
-      if getattr(self, '_local_configuration', None) is None:
-        self._local_configuration = PersistentMapping()
-      if not self._local_configuration.has_key(template_id):
-        self._local_configuration[template_id] = LocalConfiguration(**kw)
-      else:
-        self._local_configuration[template_id].update(**kw)
-
-    def getLocalConfiguration(self, template):
-      """
-        Return the configuration for the given business template, or None if
-        it's not defined.
-      """
-      template_id = template.getId()
-      if getattr(self, '_local_configuration', None) is None:
-        self._local_configuration = PersistentMapping()
-      local_configuration = self._local_configuration.get(template_id, None)
-      if local_configuration is not None:
-        return local_configuration.__of__(template)
-      return None
 
     security.declareProtected( 'Import/Export objects', 'save' )
     def save(self, business_template, REQUEST=None, RESPONSE=None):




More information about the Erp5-report mailing list