Commit 35d8a001 authored by Julien Muchembled's avatar Julien Muchembled

BT: expand ~ (HOME) of repository local paths

parent 8ea417c4
...@@ -365,10 +365,10 @@ class TemplateTool (BaseTool): ...@@ -365,10 +365,10 @@ class TemplateTool (BaseTool):
if id is None: if id is None:
id = self.generateNewId() id = self.generateNewId()
urltype, name = splittype(url) urltype, path = splittype(url)
if WIN and urltype and '\\' in name: if WIN and urltype and '\\' in path:
urltype = None urltype = None
name = url path = url
if urltype and urltype != 'file': if urltype and urltype != 'file':
if '/portal_templates/asRepository/' in url: if '/portal_templates/asRepository/' in url:
# In this case, the downloaded BT is already built. # In this case, the downloaded BT is already built.
...@@ -378,7 +378,8 @@ class TemplateTool (BaseTool): ...@@ -378,7 +378,8 @@ class TemplateTool (BaseTool):
return self[self._setObject(id, bt)] return self[self._setObject(id, bt)]
bt = self._download_url(url, id) bt = self._download_url(url, id)
else: else:
bt = self._download_local(os.path.normpath(name), id) path = os.path.normpath(os.path.expanduser(path))
bt = self._download_local(path, id)
bt.build(no_action=True) bt.build(no_action=True)
return bt return bt
...@@ -590,8 +591,10 @@ class TemplateTool (BaseTool): ...@@ -590,8 +591,10 @@ class TemplateTool (BaseTool):
""" """
Update the information on Business Templates from repositories. Update the information on Business Templates from repositories.
For local repositories, if bt5list is missing or if genbt5list > 1, For local repositories, genbt5list > 0 enables automatic generation
bt5list is automatically generated (but not saved on disk). of bt5list, without saving it on disk:
- genbt5list=1: only if bt5list is missing
- genbt5list>1: always
""" """
self.repository_dict = PersistentMapping() self.repository_dict = PersistentMapping()
property_list = ('title', 'version', 'revision', 'description', 'license', property_list = ('title', 'version', 'revision', 'description', 'license',
...@@ -607,6 +610,7 @@ class TemplateTool (BaseTool): ...@@ -607,6 +610,7 @@ class TemplateTool (BaseTool):
if urltype and urltype != 'file': if urltype and urltype != 'file':
f = urlopen(repository + '/bt5list') f = urlopen(repository + '/bt5list')
else: else:
url = os.path.expanduser(url)
bt5list = os.path.join(url, 'bt5list') bt5list = os.path.join(url, 'bt5list')
if genbt5list > os.path.exists(bt5list): if genbt5list > os.path.exists(bt5list):
f = generateInformation(url) f = generateInformation(url)
......
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