From e1925aafd513249033c6142a5d2ed1963edbb471 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com>
Date: Wed, 3 Mar 2010 14:29:00 +0000
Subject: [PATCH]  - in r33257 luke used old version of bt5-path parsing,
 without comma support

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33331 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../standaloneinstance/create_erp5_instance.py  | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/buildout/local-eggs/erp5.recipe.standaloneinstance/src/erp5/recipe/standaloneinstance/create_erp5_instance.py b/buildout/local-eggs/erp5.recipe.standaloneinstance/src/erp5/recipe/standaloneinstance/create_erp5_instance.py
index f2beb04efb..af06b21b44 100644
--- a/buildout/local-eggs/erp5.recipe.standaloneinstance/src/erp5/recipe/standaloneinstance/create_erp5_instance.py
+++ b/buildout/local-eggs/erp5.recipe.standaloneinstance/src/erp5/recipe/standaloneinstance/create_erp5_instance.py
@@ -28,7 +28,8 @@ parser.add_option("-u", "--initial-user",
                   default="zope:zope")
 parser.add_option("--bt5-path",
                   dest="bt5_path",
-                  help="Path to folder containing business templates",
+                  help="Path to folder containing business templates. "
+                  "Can be multiple, separated by commas.",
                   default="bt5")
 
 (options, args) = parser.parse_args()
@@ -44,6 +45,7 @@ options.erp5_sql_connection_string =\
       unquote(options.erp5_sql_connection_string)
 options.cmf_activity_sql_connection_string =\
       unquote(options.cmf_activity_sql_connection_string)
+
 username, password = options.user_and_pass.split(':')
 
 try:
@@ -89,8 +91,19 @@ if default_site_preference.getPreferenceState() == 'disabled':
 
 # install our business templates
 bt5_list = []
+bt5_path_list = options.bt5_path.split(',')
+
 for arg in args:
-  bt_path = os.path.join(options.bt5_path, arg)
+  bt_path = None
+  for path in bt5_path_list:
+    bt_path = os.path.join(path, arg)
+    if os.path.exists(bt_path):
+      break
+    else:
+      bt_path = None
+  if bt_path is None:
+    raise ValueError('Business Template %s not found in paths %s' % (arg,
+      options.bt5_path))
   installed_bt = portal.portal_templates.getInstalledBusinessTemplate(arg)
   if installed_bt is not None:
     # XXX this way works only for extracted business template, not for
-- 
2.30.9