diff --git a/product/ERP5/Tool/TemplateTool.py b/product/ERP5/Tool/TemplateTool.py index bc7c5f8bab5ee16788bde41c56fc3882ce3cbba1..e1ea90e3039fdd11a7f0e703b187589f99dda9ac 100644 --- a/product/ERP5/Tool/TemplateTool.py +++ b/product/ERP5/Tool/TemplateTool.py @@ -101,7 +101,7 @@ class TemplateTool (BaseTool): title = 'Template Tool' meta_type = 'ERP5 Template Tool' portal_type = 'Template Tool' - allowed_types = ('ERP5 Business Template', ) + allowed_types = ('ERP5 Business Template', 'ERP5 Business Package') # This stores information on repositories. repository_dict = {} @@ -321,9 +321,14 @@ class TemplateTool (BaseTool): REQUEST.RESPONSE.redirect("%s?portal_status_message=%s" % (ret_url, psm)) - def _download_local(self, path, bt_id): + def _download_local(self, path, bt_id, isPackage=False): """Download Business Template from local directory or file """ + if isPackage: + bp = self.newContent(bt_id, 'Business Package') + bp.importFile(path) + return bp + bt = self.newContent(bt_id, 'Business Template') bt.importFile(path) return bt @@ -353,7 +358,7 @@ class TemplateTool (BaseTool): shutil.rmtree(svn_checkout_tmp_dir) security.declareProtected( 'Import/Export objects', 'download' ) - def download(self, url, id=None, REQUEST=None): + def download(self, url, id=None, REQUEST=None, isPackage=False): """ Download Business Template from url, can be file or local directory """ @@ -361,7 +366,6 @@ class TemplateTool (BaseTool): # come from the management interface. if REQUEST is not None: return self.manage_download(url, id=id, REQUEST=REQUEST) - if id is None: id = self.generateNewId() @@ -378,7 +382,7 @@ class TemplateTool (BaseTool): return self[self._setObject(id, bt)] bt = self._download_url(url, id) else: - bt = self._download_local(os.path.normpath(name), id) + bt = self._download_local(os.path.normpath(name), id, isPackage) bt.build(no_action=True) return bt