equal
deleted
inserted
replaced
|
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 |
|
19 |
|
20 |
|
21 def includeme(config): |
|
22 config.add_route_predicate('match_is_etype', MatchIsETypePredicate) |