Commit adbc31dc authored by Łukasz Nowak's avatar Łukasz Nowak

- cast safely to integer before doing comparision, in case of failure always propose upgrade


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44729 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2a2f43e3
......@@ -1246,10 +1246,19 @@ class TemplateTool (BaseTool):
listbox_object_list = BusinessTemplate_getModifiedObject.__of__(imported_bt5)()
install_kw = {}
previous_bt5 = self.getInstalledBusinessTemplate(bt_title)
if previous_bt5 is not None and \
(imported_bt5.getRevision() <= previous_bt5.getRevision()):
log("%s is already installed with same or newer revision." % bt_title)
return imported_bt5
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())
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:
item = listbox_line.object_id
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment