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

Fix cache of Predicate.asPredicate

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