Commit 0be4533e authored by Rafael Monnerat's avatar Rafael Monnerat

Fix "Speed up Optimization"

use by using "self" on transactional_cached decorator breaks ERP5Site creation due aq_base.
parent e9511377
...@@ -877,12 +877,15 @@ class TemplateTool (BaseTool): ...@@ -877,12 +877,15 @@ class TemplateTool (BaseTool):
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getDependencyList') 'getDependencyList')
@transactional_cached(lambda self, bt: (self, bt))
def getDependencyList(self, bt): def getDependencyList(self, bt):
""" """
Return the list of missing dependencies for a business Return the list of missing dependencies for a business
template, given a tuple : (repository, id) template, given a tuple : (repository, id)
""" """
# use by using "self" on transactional_cached decorator
# breaks ERP5Site creation due aq_base.
@transactional_cached(lambda bt: (bt))
def _getDependency(bt):
# We do not take into consideration the dependencies # We do not take into consideration the dependencies
# for meta business templates # for meta business templates
if bt[0] == 'meta': if bt[0] == 'meta':
...@@ -892,7 +895,7 @@ class TemplateTool (BaseTool): ...@@ -892,7 +895,7 @@ class TemplateTool (BaseTool):
if repository == bt[0]: if repository == bt[0]:
for property_dict in property_dict_list: for property_dict in property_dict_list:
if property_dict['id'] == bt[1]: if property_dict['id'] == bt[1]:
dependency_list = property_dict['dependency_list'] dependency_list = [q for q in property_dict['dependency_list'] if q]
for dependency_couple in dependency_list: for dependency_couple in dependency_list:
# dependency_couple is like "erp5_xhtml_style (>= 0.2)" # dependency_couple is like "erp5_xhtml_style (>= 0.2)"
dependency_couple_list = dependency_couple.split(' ', 1) dependency_couple_list = dependency_couple.split(' ', 1)
...@@ -912,7 +915,7 @@ class TemplateTool (BaseTool): ...@@ -912,7 +915,7 @@ class TemplateTool (BaseTool):
try: try:
bt_dep = self.getLastestBTOnRepos(dependency, version_restriction) bt_dep = self.getLastestBTOnRepos(dependency, version_restriction)
except BusinessTemplateUnknownError: except BusinessTemplateUnknownError:
raise BusinessTemplateMissingDependency, 'The following dependency could not be satisfied: %s (%s)\nReason: Business Template could not be found in the repositories'%(dependency, version_restriction or '') raise BusinessTemplateMissingDependency, 'While analysing %s the following dependency could not be satisfied: %s (%s)\nReason: Business Template could not be found in the repositories'%(bt[1], dependency, version_restriction or '')
except BusinessTemplateIsMeta: except BusinessTemplateIsMeta:
provider_list = self.getProviderList(dependency) provider_list = self.getProviderList(dependency)
for provider in provider_list: for provider in provider_list:
...@@ -929,6 +932,8 @@ class TemplateTool (BaseTool): ...@@ -929,6 +932,8 @@ class TemplateTool (BaseTool):
return result_list return result_list
raise BusinessTemplateUnknownError, 'The Business Template %s could not be found on repository %s'%(bt[1], bt[0]) raise BusinessTemplateUnknownError, 'The Business Template %s could not be found on repository %s'%(bt[1], bt[0])
return _getDependency(bt)
def findProviderInBTList(self, provider_list, bt_list): def findProviderInBTList(self, provider_list, bt_list):
""" """
Find one provider in provider_list which is present in Find one provider in provider_list which is present in
......
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