Commit cd50a7aa authored by Julien Muchembled's avatar Julien Muchembled

asPredicate() can be customized at class level by overriding _asPredicate()

parent ac3af70f
...@@ -586,22 +586,23 @@ class Predicate(XMLObject): ...@@ -586,22 +586,23 @@ class Predicate(XMLObject):
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'asPredicate') 'asPredicate')
def asPredicate(self, script_id=None): def asPredicate(self):
""" """
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_asPredicate, MetaType_asPredicate, PortalType_asPredicate looking up methods named Class_asPredicate, MetaType_asPredicate, PortalType_asPredicate
""" """
cache = getTransactionalVariable() cache = getTransactionalVariable()
key = 'asPredicate', self, script_id key = 'asPredicate', self
try: try:
return cache[key] return cache[key]
except KeyError: except KeyError:
script = self._getTypeBasedMethod('asPredicate', script_id) self = self._getTypeBasedMethod("asPredicate", "_asPredicate")()
if script is not None:
self = script()
cache[key] = self cache[key] = self
return self return self
def _asPredicate(self):
return self
def searchPredicate(self, **kw): def searchPredicate(self, **kw):
""" """
Returns a list of documents matching the predicate Returns a list of documents matching the predicate
......
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