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
Leo Le Bouter
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
Show 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())
except ValueError:
if imported_revision <= previous_revision:
previous_revision = None
log("%s is already installed with revision %i, which is same or "
if imported_revision is not None and imported_revision is not None
\
"newer revision than new revision %i." % (bt_title,
and (imported_revision <= previous_revision):
previous_revision, imported_revision))
log("%s is already installed with revision %r, which is same or "
"newer revision then new revision %r." % (bt_title,
previous_bt5.getRevision(), imported_bt5.getRevision()))
return imported_bt5
return imported_bt5
except ValueError:
pass
for listbox_line in listbox_object_list:
install_kw = {}
for listbox_line in imported_bt5.BusinessTemplate_getModifiedObject():
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
in_force_keep_list = True
if state in ('
Modified
but
should
be
kept
',
'
Removed
but
should
be
kept
') and item not in force_keep_list:
# For actions which suggest that item shall be kept and item is not
# For actions which suggest that item shall be kept and item is not
# explicitely forced, keep the default -- do nothing
# explicitely forced, keep the default -- do nothing
keep = True
in_force_keep_list = item in force_keep_list or state not in (
in_force_keep_list = False
'
Modified
but
should
be
kept
', '
Removed
but
should
be
kept
')
in_keep_original_list = False
if item in keep_original_list:
# If item is forced to be untouched, do not touch it
# If item is forced to be untouched, do not touch it
keep = True
if item in keep_original_list or not in_force_keep_list:
in_keep_original_list = True
if in_force_keep_list:
log('
Item
%
r
is
in
force_keep_list
and
keep_original_list
,
'
if in_force_keep_list and in_keep_original_list:
'
as
keep_original_list
has
precedence
item
is
NOT
MODIFIED
'
log('
Item
%
r
is
in
force_keep_list
and
keep_original_list
,
as
'
% item)
'
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