From bdfc3b11ed78ee3cf28430cb55bdc6d4170b4b10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Calonne?= <aurel@nexedi.com> Date: Mon, 7 Nov 2005 17:30:42 +0000 Subject: [PATCH] * execute build transition at import of Business Template * don't export empty items in SiteProperty git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4271 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/BusinessTemplate.py | 7 +++++-- product/ERP5/Tool/TemplateTool.py | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py index b1ecd78f74..68254e7ddc 100755 --- a/product/ERP5/Document/BusinessTemplate.py +++ b/product/ERP5/Document/BusinessTemplate.py @@ -1342,7 +1342,8 @@ class SitePropertyTemplateItem(BaseTemplateItem): if type in ('lines', 'tokens'): xml_data += os.linesep+' <value>' for item in object: - xml_data += os.linesep+' <item>%s</item>' %(item,) + if item != '': + xml_data += os.linesep+' <item>%s</item>' %(item,) xml_data += os.linesep+' </value>' else: xml_data += os.linesep+' <value>%r</value>' %((os.linesep).join(object),) @@ -2101,10 +2102,12 @@ Business Template is a set of definitions, such as skins, portal types and categ 'business_template_installation_workflow'] = None security.declareProtected(Permissions.ManagePortal, 'build') - def build(self): + def build(self, no_action=0): """ Copy existing portal objects to self """ + if no_action: return # this is use at import of Business Template to get the status built + # Make sure that everything is sane. self.clean() diff --git a/product/ERP5/Tool/TemplateTool.py b/product/ERP5/Tool/TemplateTool.py index 680db7ab0d..a71f056618 100755 --- a/product/ERP5/Tool/TemplateTool.py +++ b/product/ERP5/Tool/TemplateTool.py @@ -249,6 +249,7 @@ class TemplateTool (BaseTool): tempid, temppath = mkstemp() file, headers = urlretrieve(url, temppath) bt = self._importBT(temppath, id) + bt.build(no_action=1) bt.reindexObject() if REQUEST is not None: @@ -277,7 +278,8 @@ class TemplateTool (BaseTool): tempfile.write(import_file.read()) tempfile.close() - bt = self._importBT(temppath, id) + bt = self._importBT(temppath, id) + bt.build(no_action=1) bt.reindexObject() if REQUEST is not None: -- 2.30.9