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

Fix cache of Predicate.asPredicate

parent 347804af
......@@ -585,16 +585,13 @@ class Predicate(XMLObject):
def asPredicate(self, script_id=None):
"""
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()
key = id(self), script_id
if 'asPredicate' in cache:
cache = cache['asPredicate']
if key in cache:
key = 'asPredicate', self, script_id
try:
return cache[key]
else:
cache = cache['asPredicate'] = {}
except KeyError:
script = self._getTypeBasedMethod('asPredicate', script_id)
if script is not None:
self = script()
......
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