[Erp5-report] r19370 - /erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Feb 19 09:56:40 CET 2008


Author: vincent
Date: Tue Feb 19 09:56:39 2008
New Revision: 19370

URL: http://svn.erp5.org?rev=19370&view=rev
Log:
Generate object_to_update dictionary automaticaly when upgrading, as it would be when upgrade is done via web interface.

Modified:
    erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py

Modified: erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py?rev=19370&r1=19369&r2=19370&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py (original)
+++ erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py Tue Feb 19 09:56:39 2008
@@ -645,22 +645,33 @@
               removeLocalConstraint(id_)
 
           update_business_templates = os.environ.get('update_business_templates') is not None
+          BusinessTemplate_getModifiedObject = aq_base(getattr(portal, 'BusinessTemplate_getModifiedObject', None))
 
           # Disable reindexing before adding templates
           # VERY IMPORTANT: Add some business templates
           for url, title in business_template_list:
             start = time.time()
+            get_install_kw = False
             if title in [x.getTitle() for x in portal.portal_templates.getInstalledBusinessTemplateList()]:
               if update_business_templates:
                 if not quiet:
                   ZopeTestCase._print('Updating %s business template ... ' % title)
+                if BusinessTemplate_getModifiedObject is not None:
+                  get_install_kw = True
               else:
                 continue
             else:
               if not quiet:
                 ZopeTestCase._print('Adding %s business template ... ' % title)
             bt = portal.portal_templates.download(url)
-            bt.install(light_install=light_install)
+            if not quiet:
+              ZopeTestCase._print('(downloaded in %.3fs) ' % (time.time() - start))
+            install_kw = {}
+            if get_install_kw:
+              listbox_object_list = BusinessTemplate_getModifiedObject.__of__(bt)()
+              for listbox_line in listbox_object_list:
+                install_kw[listbox_line.object_id] = listbox_line.choice_item_list[0][1]
+            bt.install(light_install=light_install, object_to_update=install_kw)
             # Release locks
             get_transaction().commit()
             if not quiet:




More information about the Erp5-report mailing list