Commit b8e53d65 authored by Vincent Pelletier's avatar Vincent Pelletier

ERP5Site: Define core business template list in a convenient place.

Also, use it in Products.ERP5Type.tests.ERP5TypeTestCase.
parent 8ad44c55
...@@ -278,6 +278,22 @@ class ERP5Site(ResponseHeaderGenerator, FolderMixIn, PortalObjectBase, CacheCook ...@@ -278,6 +278,22 @@ class ERP5Site(ResponseHeaderGenerator, FolderMixIn, PortalObjectBase, CacheCook
PortalObjectBase.__init__(self, id) PortalObjectBase.__init__(self, id)
self.creation_date = DateTime() self.creation_date = DateTime()
security.declarePrivate('getCoreBusinessTemplateList')
def getCoreBusinessTemplateList(self):
"""
Return the list of business templates expected to be installed when this
class is instanciated. Allows including these business templates in the
list of business templates to upgrade (ex: in upgrade unit tests) without
duplicating this list.
"""
return [
'erp5_property_sheets',
'erp5_core',
self.erp5_catalog_storage,
'erp5_jquery',
'erp5_xhtml_style',
]
security.declarePrivate('reindexObject') security.declarePrivate('reindexObject')
def reindexObject(self, idxs=[]): def reindexObject(self, idxs=[]):
"""from Products.CMFDefault.Portal""" """from Products.CMFDefault.Portal"""
...@@ -2402,8 +2418,7 @@ class ERP5Generator(PortalGenerator): ...@@ -2402,8 +2418,7 @@ class ERP5Generator(PortalGenerator):
""" """
template_tool = p.portal_templates template_tool = p.portal_templates
if template_tool.getInstalledBusinessTemplate('erp5_core') is None: if template_tool.getInstalledBusinessTemplate('erp5_core') is None:
for bt in ('erp5_property_sheets', 'erp5_core', p.erp5_catalog_storage, 'erp5_jquery', for bt in p.getCoreBusinessTemplateList():
'erp5_xhtml_style'):
if not bt: if not bt:
continue continue
url = getBootstrapBusinessTemplateUrl(bt) url = getBootstrapBusinessTemplateUrl(bt)
......
...@@ -1047,8 +1047,15 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin): ...@@ -1047,8 +1047,15 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
update_business_templates = os.environ.get('update_business_templates') is not None update_business_templates = os.environ.get('update_business_templates') is not None
erp5_load_data_fs = int(os.environ.get('erp5_load_data_fs', 0)) erp5_load_data_fs = int(os.environ.get('erp5_load_data_fs', 0))
if update_business_templates and erp5_load_data_fs: if update_business_templates and erp5_load_data_fs:
template_list[:0] = (erp5_catalog_storage, 'erp5_property_sheets', app = self._app()
'erp5_core', 'erp5_xhtml_style') try:
template_list[:0] = app._getOb(
self.getPortalName(),
).getCoreBusinessTemplateList()
finally:
self.abort()
ZopeTestCase.close(app)
del app
# keep a mapping type info name -> property sheet list, to remove them in # keep a mapping type info name -> property sheet list, to remove them in
# tear down. # tear down.
......
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