Commit 451aa813 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

fix getDefaultConfigurationPropertyDict and...

fix getDefaultConfigurationPropertyDict and getDefaultConfigurationPropertyListDict implementations.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36733 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cac80dc9
...@@ -151,8 +151,8 @@ class SolverTypeInformation(Predicate, ERP5TypeInformation): ...@@ -151,8 +151,8 @@ class SolverTypeInformation(Predicate, ERP5TypeInformation):
configurable -- a configurable document (Solver Decision configurable -- a configurable document (Solver Decision
or Target Solver) or Target Solver)
""" """
return self._callTypeBasetMethod( return self._callTypeBasedMethod(
self, 'getDefaultConfigurationPropertyDict') configurable, 'getDefaultConfigurationPropertyDict')
def getDefaultConfigurationProperty(self, property, configurable): def getDefaultConfigurationProperty(self, property, configurable):
""" """
...@@ -175,8 +175,8 @@ class SolverTypeInformation(Predicate, ERP5TypeInformation): ...@@ -175,8 +175,8 @@ class SolverTypeInformation(Predicate, ERP5TypeInformation):
configurable -- a configurable document (Solver Decision configurable -- a configurable document (Solver Decision
or Target Solver) or Target Solver)
""" """
return self._callTypeBasetMethod( return self._callTypeBasedMethod(
self, 'getDefaultConfigurationPropertyListDict') configurable, 'getDefaultConfigurationPropertyListDict')
def getDefaultConfigurationPropertyList(self, property, configurable): def getDefaultConfigurationPropertyList(self, property, configurable):
""" """
...@@ -188,7 +188,7 @@ class SolverTypeInformation(Predicate, ERP5TypeInformation): ...@@ -188,7 +188,7 @@ class SolverTypeInformation(Predicate, ERP5TypeInformation):
""" """
return self.getDefaultConfigurationPropertyListDict().get(property, []) return self.getDefaultConfigurationPropertyListDict().get(property, [])
def _callTypeBasedMethod(self, method_id, configurable): def _callTypeBasedMethod(self, configurable, method_id):
# Implemented through type based method # Implemented through type based method
# and using read transaction cache # and using read transaction cache
portal_type = configurable.getPortalType() portal_type = configurable.getPortalType()
...@@ -206,11 +206,12 @@ class SolverTypeInformation(Predicate, ERP5TypeInformation): ...@@ -206,11 +206,12 @@ class SolverTypeInformation(Predicate, ERP5TypeInformation):
cache = getReadOnlyTransactionCache(self) cache = getReadOnlyTransactionCache(self)
if cache is not None: if cache is not None:
key = (method_id, solver_portal_type, key = (method_id, solver_portal_type)
configurable.getRelativeUrl())
try: try:
method = cache[key] return cache[key]()
except KeyError: except KeyError:
pass
if solver is None: if solver is None:
solver = self.getParentValue().newContent( solver = self.getParentValue().newContent(
portal_type=solver_portal_type, portal_type=solver_portal_type,
...@@ -220,5 +221,6 @@ class SolverTypeInformation(Predicate, ERP5TypeInformation): ...@@ -220,5 +221,6 @@ class SolverTypeInformation(Predicate, ERP5TypeInformation):
method = solver._getTypeBasedMethod( method = solver._getTypeBasedMethod(
method_id, method_id,
fallback_script_id='Solver_%s' % method_id) fallback_script_id='Solver_%s' % method_id)
if cache is not None:
cache[key] = method cache[key] = method
return method() return method()
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