Register predicates from the predicates module
authorChristophe de Vienne <cdevienne@gmail.com>
Wed, 16 Sep 2015 16:39:53 +0200
changeset 11601 23a62d151382
parent 11600 473754eac7c1
child 11602 0737f481b358
Register predicates from the predicates module
pyramid_cubicweb/__init__.py
pyramid_cubicweb/predicates.py
pyramid_cubicweb/rest_api.py
--- a/pyramid_cubicweb/__init__.py	Fri Jul 24 13:39:18 2015 +0200
+++ b/pyramid_cubicweb/__init__.py	Wed Sep 16 16:39:53 2015 +0200
@@ -176,6 +176,7 @@
         config.include(name)
 
     config.include('pyramid_cubicweb.tools')
+    config.include('pyramid_cubicweb.predicates')
     config.include('pyramid_cubicweb.core')
 
     if asbool(config.registry.settings.get('cubicweb.bwcompat', True)):
--- a/pyramid_cubicweb/predicates.py	Fri Jul 24 13:39:18 2015 +0200
+++ b/pyramid_cubicweb/predicates.py	Wed Sep 16 16:39:53 2015 +0200
@@ -16,3 +16,7 @@
     def __call__(self, info, request):
         return info['match'][self.matchname].lower() in \
             request.registry['cubicweb.registry'].case_insensitive_etypes
+
+
+def includeme(config):
+    config.add_route_predicate('match_is_etype', MatchIsETypePredicate)
--- a/pyramid_cubicweb/rest_api.py	Fri Jul 24 13:39:18 2015 +0200
+++ b/pyramid_cubicweb/rest_api.py	Wed Sep 16 16:39:53 2015 +0200
@@ -18,7 +18,6 @@
 
 
 def includeme(config):
-    config.add_route_predicate('match_is_etype', MatchIsETypePredicate)
     config.add_route(
         'cwentities', '/{etype}/*traverse',
         factory=ETypeResource.from_match('etype'), match_is_etype='etype')