Commit 84afd096 authored by Rafael Monnerat's avatar Rafael Monnerat

Use Set() instead lists to simplify the code.

parent 799fe78e
...@@ -147,14 +147,12 @@ class ERP5Updater(object): ...@@ -147,14 +147,12 @@ class ERP5Updater(object):
return [i for i in self.business_template_repository_list return [i for i in self.business_template_repository_list
if i not in found_list] if i not in found_list]
def getMissingBusinessTemplateList(self): def getMissingBusinessTemplateSet(self):
bt5_dict = self.getSystemSignatureDict("business_template_dict", {}) found_dict = self.getSystemSignatureDict("business_template_dict", {})
found_bt5_list = bt5_dict.keys() return set(self.business_template_list).difference(found_dict)
return [bt for bt in self.business_template_list\
if bt not in found_bt5_list]
def isBusinessTemplateUpdated(self): def isBusinessTemplateUpdated(self):
return len(self.getMissingBusinessTemplateList()) == 0 return len(self.getMissingBusinessTemplateSet()) == 0
def isBusinessTemplateRepositoryUpdated(self): def isBusinessTemplateRepositoryUpdated(self):
return len(self.getMissingBusinessTemplateRepositoryList()) == 0 return len(self.getMissingBusinessTemplateRepositoryList()) == 0
...@@ -173,8 +171,7 @@ class ERP5Updater(object): ...@@ -173,8 +171,7 @@ class ERP5Updater(object):
self._setRepositoryList(repository_list) self._setRepositoryList(repository_list)
# Require to update Business template # Require to update Business template
for bt in self.getMissingBusinessTemplateList(): self._installBusinessTemplateList(list(self.getMissingBusinessTemplateSet()))
self._installBusinessTemplateList([bt])
return True return True
return False return False
......
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