pyramid_cubicweb/predicates.py
changeset 11600 473754eac7c1
child 11601 23a62d151382
equal deleted inserted replaced
11599:f8ba6ea94af9 11600:473754eac7c1
       
     1 """Contains predicates used in Pyramid views.
       
     2 """
       
     3 
       
     4 
       
     5 class MatchIsETypePredicate(object):
       
     6     """A predicate that match if a given etype exist in schema.
       
     7     """
       
     8     def __init__(self, matchname, config):
       
     9         self.matchname = matchname
       
    10 
       
    11     def text(self):
       
    12         return 'match_is_etype = %s' % self.matchname
       
    13 
       
    14     phash = text
       
    15 
       
    16     def __call__(self, info, request):
       
    17         return info['match'][self.matchname].lower() in \
       
    18             request.registry['cubicweb.registry'].case_insensitive_etypes