pyramid_cubicweb/bwcompat.py
changeset 11588 50e1fda83837
parent 11578 fcba04437236
child 11607 5b36399b6b21
--- a/pyramid_cubicweb/bwcompat.py	Mon Jul 06 14:51:06 2015 +0200
+++ b/pyramid_cubicweb/bwcompat.py	Fri Jul 24 14:21:13 2015 +0200
@@ -4,6 +4,7 @@
 from pyramid import tweens
 from pyramid.httpexceptions import HTTPSeeOther
 from pyramid import httpexceptions
+from pyramid.settings import asbool
 
 import cubicweb
 import cubicweb.web
@@ -196,6 +197,8 @@
 
     config.add_tween(
         'pyramid_cubicweb.bwcompat.TweenHandler', under=tweens.EXCVIEW)
-    config.add_view(cwhandler.error_handler, context=Exception)
-    # XXX why do i need this?
-    config.add_view(cwhandler.error_handler, context=httpexceptions.HTTPForbidden)
+    if asbool(config.registry.settings.get(
+            'cubicweb.bwcompat.errorhandler', True)):
+        config.add_view(cwhandler.error_handler, context=Exception)
+        # XXX why do i need this?
+        config.add_view(cwhandler.error_handler, context=httpexceptions.HTTPForbidden)