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
Pipeline #19761 failed with stage
in 0 seconds
......@@ -278,6 +278,22 @@ class ERP5Site(ResponseHeaderGenerator, FolderMixIn, PortalObjectBase, CacheCook
PortalObjectBase.__init__(self, id)
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')
def reindexObject(self, idxs=[]):
"""from Products.CMFDefault.Portal"""
......@@ -2402,8 +2418,7 @@ class ERP5Generator(PortalGenerator):
"""
template_tool = p.portal_templates
if template_tool.getInstalledBusinessTemplate('erp5_core') is None:
for bt in ('erp5_property_sheets', 'erp5_core', p.erp5_catalog_storage, 'erp5_jquery',
'erp5_xhtml_style'):
for bt in p.getCoreBusinessTemplateList():
if not bt:
continue
url = getBootstrapBusinessTemplateUrl(bt)
......
......@@ -1047,8 +1047,15 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
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))
if update_business_templates and erp5_load_data_fs:
template_list[:0] = (erp5_catalog_storage, 'erp5_property_sheets',
'erp5_core', 'erp5_xhtml_style')
app = self._app()
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
# 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