Enable to export several business template at the same time


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33646 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 95e21ea5
...@@ -311,7 +311,7 @@ class BusinessTemplateArchive: ...@@ -311,7 +311,7 @@ class BusinessTemplateArchive:
def addObject(self, *kw): def addObject(self, *kw):
pass pass
def finishCreation(self, **kw): def finishCreation(self, name=None, **kw):
pass pass
class BusinessTemplateFolder(BusinessTemplateArchive): class BusinessTemplateFolder(BusinessTemplateArchive):
...@@ -431,10 +431,10 @@ class BusinessTemplateTarball(BusinessTemplateArchive): ...@@ -431,10 +431,10 @@ class BusinessTemplateTarball(BusinessTemplateArchive):
f.write(str(obj)) f.write(str(obj))
f.close() f.close()
def finishCreation(self): def finishCreation(self, name):
self.tar.add(self.path) self.tar.add(name)
self.tar.close() self.tar.close()
shutil.rmtree(self.path) shutil.rmtree(name)
return self.fobj return self.fobj
def _initImport(self, file=None, **kw): def _initImport(self, file=None, **kw):
...@@ -5508,7 +5508,7 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -5508,7 +5508,7 @@ Business Template is a set of definitions, such as skins, portal types and categ
for item_name in self._item_name_list: for item_name in self._item_name_list:
getattr(self, item_name).export(context=self, bta=bta) getattr(self, item_name).export(context=self, bta=bta)
return bta.finishCreation() return bta.finishCreation(self.getTitle())
security.declareProtected(Permissions.ManagePortal, 'importFile') security.declareProtected(Permissions.ManagePortal, 'importFile')
def importFile(self, dir = 0, file=None, root_path=None): def importFile(self, dir = 0, file=None, root_path=None):
......
...@@ -218,7 +218,8 @@ class TemplateTool (BaseTool): ...@@ -218,7 +218,8 @@ class TemplateTool (BaseTool):
# XXX not thread safe # XXX not thread safe
current_directory = os.getcwd() current_directory = os.getcwd()
os.chdir(tmpdir_path) os.chdir(tmpdir_path)
export_string = business_template.export(path=path) absolute_path = os.path.abspath(path)
export_string = business_template.export(path=absolute_path)
os.chdir(current_directory) os.chdir(current_directory)
if RESPONSE is not None: if RESPONSE is not None:
RESPONSE.setHeader('Content-type','tar/x-gzip') RESPONSE.setHeader('Content-type','tar/x-gzip')
......
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