From 7802366d8a175bb593c96e2eb1915ee4baf163cf Mon Sep 17 00:00:00 2001
From: Fabien Morin <fabien@nexedi.com>
Date: Fri, 16 Oct 2009 07:29:31 +0000
Subject: [PATCH] before installing all bt, check if all needed bt paths are
 present on the file system. This change permit to not waste time in case of
 missing bt (you don't have to wait for all previous bt to be installed to get
 the error message) and the time cost of this operation is negligible (less
 than 0.007 seconds for 52 bt on my 2 cores 2Gb Ram machine)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29731 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Type/tests/ERP5TypeTestCase.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/product/ERP5Type/tests/ERP5TypeTestCase.py b/product/ERP5Type/tests/ERP5TypeTestCase.py
index 55051814a7..8a13cd211c 100644
--- a/product/ERP5Type/tests/ERP5TypeTestCase.py
+++ b/product/ERP5Type/tests/ERP5TypeTestCase.py
@@ -748,6 +748,18 @@ class ERP5TypeTestCase(PortalTestCase):
             update_business_templates = os.environ.get('update_business_templates') is not None
             BusinessTemplate_getModifiedObject = aq_base(getattr(portal, 'BusinessTemplate_getModifiedObject', None))
 
+            # check that all bt5 exists, this permit to save time in case of
+            # missing bt
+            missing_bt_list = []
+            from DateTime import DateTime
+            for url, bt_title in business_template_list:
+              # if the bt is not found, an error is raised
+              if not portal.portal_templates.assertBtPathExists(url):
+                missing_bt_list.append(bt_title)
+            if len(missing_bt_list):
+              raise "Some bt can't be found on your system : %r" % \
+                missing_bt_list
+
             # Add some business templates
             for url, bt_title in business_template_list:
               start = time.time()
-- 
2.30.9