Commit 47def68c authored by Julien Muchembled's avatar Julien Muchembled

Fix cache of Predicate.asPredicate

parent 347804af
...@@ -585,21 +585,18 @@ class Predicate(XMLObject): ...@@ -585,21 +585,18 @@ class Predicate(XMLObject):
def asPredicate(self, script_id=None): def asPredicate(self, script_id=None):
""" """
This method tries to convert the current Document into a predicate This method tries to convert the current Document into a predicate
looking up methods named Class_asPredictae, MetaType_asPredicate, PortalType_asPredicate looking up methods named Class_asPredicate, MetaType_asPredicate, PortalType_asPredicate
""" """
cache = getTransactionalVariable() cache = getTransactionalVariable()
key = id(self), script_id key = 'asPredicate', self, script_id
if 'asPredicate' in cache: try:
cache = cache['asPredicate'] return cache[key]
if key in cache: except KeyError:
return cache[key] script = self._getTypeBasedMethod('asPredicate', script_id)
else: if script is not None:
cache = cache['asPredicate'] = {} self = script()
script = self._getTypeBasedMethod('asPredicate', script_id) cache[key] = self
if script is not None: return self
self = script()
cache[key] = self
return self
def searchPredicate(self, **kw): def searchPredicate(self, **kw):
""" """
......
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