[Erp5-report] r38338 aurel - /erp5/trunk/products/ERP5/Tool/TemplateTool.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Sep 14 12:01:09 CEST 2010


Author: aurel
Date: Tue Sep 14 12:01:07 2010
New Revision: 38338

URL: http://svn.erp5.org?rev=38338&view=rev
Log:
when getting list of upgradable bt5, do not take replaced bt5 into account

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

Modified: erp5/trunk/products/ERP5/Tool/TemplateTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Tool/TemplateTool.py?rev=38338&r1=38337&r2=38338&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Tool/TemplateTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Tool/TemplateTool.py [utf8] Tue Sep 14 12:01:07 2010
@@ -107,13 +107,14 @@ class TemplateTool (BaseTool):
     security.declareProtected( Permissions.ManagePortal, 'manage_overview' )
     manage_overview = DTMLFile( 'explainTemplateTool', _dtmldir )
 
-    def getInstalledBusinessTemplate(self, title, **kw):
+    def getInstalledBusinessTemplate(self, title, strict=False, **kw):
       """
         Return an installed version of business template of a certain title.
 
         It not "installed" business template is found, look at replaced ones.
         This is mostly usefull if we are looking for the installed business
-        template in a transaction replacing an existing business template
+        template in a transaction replacing an existing business template.
+        If strict is true, we do not take care of "replaced" business templates.
       """
       # This can be slow if, say, 10000 business templates are present.
       # However, that unlikely happens, and using a Z SQL Method has a
@@ -126,7 +127,7 @@ class TemplateTool (BaseTool):
           installation_state = bt.getInstallationState()
           if installation_state == 'installed':
             return bt
-          elif installation_state == 'replaced':
+          elif strict is False and installation_state == 'replaced':
             replaced_list_append((bt.getId(), bt.getRevision()))
       # still there means that we might search for a replaced bt
       if len(replaced_list):
@@ -1004,7 +1005,7 @@ class TemplateTool (BaseTool):
         # Next, select only updated business templates.
         for repository, property_dict in template_item_dict.values():
           installed_bt = \
-              self.getInstalledBusinessTemplate(property_dict['title'])
+              self.getInstalledBusinessTemplate(property_dict['title'], strict=True)
           if installed_bt is not None:
             diff_version = self.compareVersions(installed_bt.getVersion(),
                                                 property_dict['version'])




More information about the Erp5-report mailing list