Commit d81596b3 authored by Laurent Peuch's avatar Laurent Peuch
Browse files

fix: re-introduce cubicweb.pyramid.predicates.MatchIsETypePredicate

branch : 3.28
parent a2f8e7258772
......@@ -24,6 +24,22 @@
from cubicweb._exceptions import UnknownEid
class MatchIsETypePredicate:
"""A predicate that match if a given etype exist in schema.
def __init__(self, matchname, config):
self.matchname = matchname
def text(self):
return 'match_is_etype = %s' % self.matchname
phash = text
def __call__(self, info, request):
return info['match'][self.matchname].lower() in \
class MatchIsEIDPredicate(object):
"""A predicate that match if a given eid exist in the database.
......@@ -129,6 +145,7 @@ class HasCWPermissionViewPredicate(HasCWPermissionRoutePredicate):
def includeme(config):
config.add_route_predicate('match_is_etype', MatchIsETypePredicate)
config.add_route_predicate('has_cw_permission', HasCWPermissionRoutePredicate)
config.add_view_predicate('has_cw_permission', HasCWPermissionViewPredicate)
config.add_route_predicate('match_is_eid', MatchIsEIDPredicate)
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