Commit a44b1f22 authored by Aurel's avatar Aurel

Try to get first business template in plain format at site install and

for installation of business template in unit test


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4454 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f77f05d9
...@@ -990,6 +990,8 @@ class ERP5Generator(PortalGenerator): ...@@ -990,6 +990,8 @@ class ERP5Generator(PortalGenerator):
if template_tool is None: if template_tool is None:
return return
bootstrap_dir = self.getBootstrapDirectory() bootstrap_dir = self.getBootstrapDirectory()
template = os.path.join(bootstrap_dir, 'erp5_core')
if not os.path.exists(template):
template = os.path.join(bootstrap_dir, 'erp5_core.bt5') template = os.path.join(bootstrap_dir, 'erp5_core.bt5')
id = template_tool.generateNewId() id = template_tool.generateNewId()
......
...@@ -107,9 +107,9 @@ class ERP5TypeTestCase(PortalTestCase): ...@@ -107,9 +107,9 @@ class ERP5TypeTestCase(PortalTestCase):
return portal_name + '_' + uid return portal_name + '_' + uid
def getPortal(self): def getPortal(self):
'''Returns the portal object, i.e. the "fixture root". """Returns the portal object, i.e. the "fixture root".
Override if you don't like the default. Override if you don't like the default.
''' """
return self.app[self.getPortalName()] return self.app[self.getPortalName()]
def enableLightInstall(self): def enableLightInstall(self):
...@@ -166,12 +166,20 @@ class ERP5TypeTestCase(PortalTestCase): ...@@ -166,12 +166,20 @@ class ERP5TypeTestCase(PortalTestCase):
file, headers = urlretrieve(template) file, headers = urlretrieve(template)
except IOError : except IOError :
from glob import glob from glob import glob
template_list = glob(os.path.join(INSTANCE_HOME, 'bt5', '*', '%s' % template))
if len(template_list) == 0:
template_list = glob(os.path.join(INSTANCE_HOME, 'bt5', '*', '%s.bt5' % template)) template_list = glob(os.path.join(INSTANCE_HOME, 'bt5', '*', '%s.bt5' % template))
template = len(template_list) and template_list[0] or '%s.bt5' % id if not (len(template_list) and template_list[0]):
template = '%s' % id
if not os.path.exists(template):
template = '%s.bt5' % id
else:
template = template_list[0]
else : else :
template = '%s' % template
if not os.path.exists(template):
template = '%s.bt5' % template template = '%s.bt5' % template
new_template_list.append((template,id)) new_template_list.append((template,id))
LOG('new_template_list',0,template_list)
light_install = self.enableLightInstall() light_install = self.enableLightInstall()
create_activities = self.enableActivityTool() create_activities = self.enableActivityTool()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment