Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alecs_myu
erp5
Commits
18479443
Commit
18479443
authored
Jan 16, 2017
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bt5_prototype: Update template tool download function with parameter to check for portal_type
parent
640bbe02
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
product/ERP5/Tool/TemplateTool.py
product/ERP5/Tool/TemplateTool.py
+9
-5
No files found.
product/ERP5/Tool/TemplateTool.py
View file @
18479443
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment