Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5_fork
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
Eteri
erp5_fork
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):
log("Installing %s ..." % download_url)
imported_bt5 = self.download(url = download_url, id = id)
bt_title = imported_bt5.getTitle()
BusinessTemplate_getModifiedObject =
\
aq_base(getattr(self, '
BusinessTemplate_getModifiedObject
'))
if not reinstall:
listbox_object_list = BusinessTemplate_getModifiedObject.__of__(imported_bt5)()
install_kw = {}
previous_bt5 = self.getInstalledBusinessTemplate(bt_title)
if previous_bt5 is not None:
try:
imported_revision = int(imported_bt5.getRevision())
except ValueError:
imported_revision = None
try:
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:
previous_revision = None
if imported_revision is not None and imported_revision is not None
\
and (imported_revision <= previous_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
for listbox_line in listbox_object_list:
pass
install_kw = {}
for listbox_line in imported_bt5.BusinessTemplate_getModifiedObject():
item = listbox_line.object_id
state = listbox_line.object_state
if state.startswith('
Removed
'):
...
...
@@ -1326,27 +1319,17 @@ class TemplateTool (BaseTool):
maybe_moved and '
(
moved
to
%
s
?
)
' % maybe_moved))
else:
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
# explicitely forced, keep the default -- do nothing
keep = True
in_force_keep_list = False
in_keep_original_list = False
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:
# For actions which suggest that item shall be kept and item is not
# explicitely forced, keep the default -- do nothing
in_force_keep_list = item in force_keep_list or state not in (
'
Modified
but
should
be
kept
', '
Removed
but
should
be
kept
')
# If item is forced to be untouched, do not touch it
if item in keep_original_list or not in_force_keep_list:
if in_force_keep_list:
log('
Item
%
r
is
in
force_keep_list
and
keep_original_list
,
'
'
as
keep_original_list
has
precedence
item
is
NOT
MODIFIED
'
% item)
install_kw[item] = '
nothing
'
else:
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