Commit d7ec580c authored by Aurel's avatar Aurel

fix bug at export when there is spaces in name


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4652 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 99edcf18
...@@ -132,8 +132,7 @@ class BusinessTemplateFolder(BusinessTemplateArchive): ...@@ -132,8 +132,7 @@ class BusinessTemplateFolder(BusinessTemplateArchive):
os.makedirs(self.path) os.makedirs(self.path)
def addFolder(self, name=''): def addFolder(self, name=''):
name = pathname2url(name) if name !='':
if name !='':
path = os.path.join(self.path, name) path = os.path.join(self.path, name)
if not os.path.exists(path): if not os.path.exists(path):
os.makedirs(path) os.makedirs(path)
...@@ -193,8 +192,7 @@ class BusinessTemplateTarball(BusinessTemplateArchive): ...@@ -193,8 +192,7 @@ class BusinessTemplateTarball(BusinessTemplateArchive):
self.tar = tarfile.open('', 'w:gz', self.fobj) self.tar = tarfile.open('', 'w:gz', self.fobj)
def addFolder(self, name=''): def addFolder(self, name=''):
name = pathname2url(name) if not os.path.exists(name):
if not os.path.exists(name):
os.makedirs(name) os.makedirs(name)
def addObject(self, object, name, path=None, ext='.xml'): def addObject(self, object, name, path=None, ext='.xml'):
...@@ -3053,8 +3051,7 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -3053,8 +3051,7 @@ Business Template is a set of definitions, such as skins, portal types and categ
""" """
if self.getBuildingState() != 'built': if self.getBuildingState() != 'built':
raise TemplateConditionError, 'Business Template must be build before export' raise TemplateConditionError, 'Business Template must be build before export'
if local: if local:
# we export into a folder tree # we export into a folder tree
bta = BusinessTemplateFolder(creation=1, path=path) bta = BusinessTemplateFolder(creation=1, path=path)
...@@ -3078,8 +3075,7 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -3078,8 +3075,7 @@ Business Template is a set of definitions, such as skins, portal types and categ
# Export each part # Export each part
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()
security.declareProtected(Permissions.ManagePortal, 'importFile') security.declareProtected(Permissions.ManagePortal, 'importFile')
......
...@@ -128,6 +128,7 @@ class TemplateTool (BaseTool): ...@@ -128,6 +128,7 @@ class TemplateTool (BaseTool):
""" """
cfg = getConfiguration() cfg = getConfiguration()
path = os.path.join(cfg.clienthome, '%s' % (business_template.getTitle(),)) path = os.path.join(cfg.clienthome, '%s' % (business_template.getTitle(),))
path = pathname2url(path)
business_template.export(path=path, local=1) business_template.export(path=path, local=1)
if REQUEST is not None: if REQUEST is not None:
ret_url = business_template.absolute_url() + '/' + REQUEST.get('form_id', 'view') ret_url = business_template.absolute_url() + '/' + REQUEST.get('form_id', 'view')
......
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