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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Noah Brackenbury
erp5
Commits
b3e4561c
Commit
b3e4561c
authored
Jul 11, 2011
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify code in TemplateTool.updateBusinessTemplateFromUrl
parent
79a2aaf5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
37 deletions
+20
-37
product/ERP5/Tool/TemplateTool.py
product/ERP5/Tool/TemplateTool.py
+20
-37
No files found.
product/ERP5/Tool/TemplateTool.py
View file @
b3e4561c
...
@@ -1291,30 +1291,23 @@ class TemplateTool (BaseTool):
...
@@ -1291,30 +1291,23 @@ class TemplateTool (BaseTool):
log("Installing %s ..." % download_url)
log("Installing %s ..." % download_url)
imported_bt5 = self.download(url = download_url, id = id)
imported_bt5 = self.download(url = download_url, id = id)
bt_title = imported_bt5.getTitle()
bt_title = imported_bt5.getTitle()
BusinessTemplate_getModifiedObject =
\
aq_base(getattr(self, '
BusinessTemplate_getModifiedObject
'))
if not reinstall:
if not reinstall:
listbox_object_list = BusinessTemplate_getModifiedObject.__of__(imported_bt5)()
install_kw = {}
previous_bt5 = self.getInstalledBusinessTemplate(bt_title)
previous_bt5 = self.getInstalledBusinessTemplate(bt_title)
if previous_bt5 is not None:
if previous_bt5 is not None:
try:
try:
imported_revision = int(imported_bt5.getRevision())
imported_revision = int(imported_bt5.getRevision())
except ValueError:
imported_revision = None
try:
previous_revision = int(previous_bt5.getRevision())
previous_revision = int(previous_bt5.getRevision())
if imported_revision <= previous_revision:
log("%s is already installed with revision %i, which is same or "
"newer revision than new revision %i." % (bt_title,
previous_revision, imported_revision))
return imported_bt5
except ValueError:
except ValueError:
previous_revision = None
pass
if imported_revision is not None and imported_revision is not None
\
and (imported_revision <= previous_revision):
install_kw = {}
log("%s is already installed with revision %r, which is same or "
for listbox_line in imported_bt5.BusinessTemplate_getModifiedObject():
"newer revision then new revision %r." % (bt_title,
previous_bt5.getRevision(), imported_bt5.getRevision()))
return imported_bt5
for listbox_line in listbox_object_list:
item = listbox_line.object_id
item = listbox_line.object_id
state = listbox_line.object_state
state = listbox_line.object_state
if state.startswith('
Removed
'):
if state.startswith('
Removed
'):
...
@@ -1326,27 +1319,17 @@ class TemplateTool (BaseTool):
...
@@ -1326,27 +1319,17 @@ class TemplateTool (BaseTool):
maybe_moved and '
(
moved
to
%
s
?
)
' % maybe_moved))
maybe_moved and '
(
moved
to
%
s
?
)
' % maybe_moved))
else:
else:
installed_dict[item] = bt_title
installed_dict[item] = bt_title
# Calculate keep logic, by following the default
keep = False
# For actions which suggest that item shall be kept and item is not
in_force_keep_list = True
# explicitely forced, keep the default -- do nothing
if state in ('
Modified
but
should
be
kept
',
in_force_keep_list = item in force_keep_list or state not in (
'
Removed
but
should
be
kept
') and item not in force_keep_list:
'
Modified
but
should
be
kept
', '
Removed
but
should
be
kept
')
# For actions which suggest that item shall be kept and item is not
# If item is forced to be untouched, do not touch it
# explicitely forced, keep the default -- do nothing
if item in keep_original_list or not in_force_keep_list:
keep = True
if in_force_keep_list:
in_force_keep_list = False
log('
Item
%
r
is
in
force_keep_list
and
keep_original_list
,
'
'
as
keep_original_list
has
precedence
item
is
NOT
MODIFIED
'
in_keep_original_list = False
% item)
if item in keep_original_list:
# If item is forced to be untouched, do not touch it
keep = True
in_keep_original_list = True
if in_force_keep_list and in_keep_original_list:
log('
Item
%
r
is
in
force_keep_list
and
keep_original_list
,
as
'
'
keep_original_list
has
precedence
item
is
NOT
MODIFIED
' % item)
if keep == True:
install_kw[item] = '
nothing
'
install_kw[item] = '
nothing
'
else:
else:
install_kw[item] = listbox_line.choice_item_list[0][1]
install_kw[item] = listbox_line.choice_item_list[0][1]
...
...
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