From 12e73a994528282ed4933a6302c246f348f80f44 Mon Sep 17 00:00:00 2001
From: Alexandre Boeglin <alex@nexedi.com>
Date: Tue, 25 Jan 2005 16:47:42 +0000
Subject: [PATCH] We now look for business templates in every subdirectory of
 INSTANCE_HOME/bt5 .

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

diff --git a/product/ERP5Type/tests/ERP5TypeTestCase.py b/product/ERP5Type/tests/ERP5TypeTestCase.py
index 12dc66f9a5..cbda2ea677 100755
--- a/product/ERP5Type/tests/ERP5TypeTestCase.py
+++ b/product/ERP5Type/tests/ERP5TypeTestCase.py
@@ -137,12 +137,15 @@ class ERP5TypeTestCase(PortalTestCase):
         LOG('template_list',0,template_list)
         for template in template_list:
           id = template
-          try:
+          try :
             from urllib import urlretrieve
             file, headers = urlretrieve(template)
-          except IOError:
-            template = INSTANCE_HOME + '/bt5/erp5_bt5/' + template
-          template = '%s.bt5' % template
+          except IOError :
+            from glob import glob
+            template_list = glob(os.path.join(INSTANCE_HOME, 'bt5', '*', '%s.bt5' % template))
+            template = len(template_list) and template_list[0] or '%s.bt5' % id
+          else :
+            template = '%s.bt5' % template
           new_template_list.append((template,id))
         LOG('new_template_list',0,template_list)
 
-- 
2.30.9