--- a/docs/narr/settings.rst Mon Jul 06 14:51:06 2015 +0200
+++ b/docs/narr/settings.rst Fri Jul 24 14:21:13 2015 +0200
@@ -92,6 +92,11 @@
(True) Enable/disable backward compatibility. See :ref:`bwcompat_module`.
+.. confval:: cubicweb.bwcompat.errorhandler (bool)
+
+ (True) Enable/disable the backward compatibility error handler.
+ Set to 'no' if you need to define your own error handlers.
+
.. confval:: cubicweb.defaults (bool)
(True) Enable/disable defaults. See :ref:`defaults_module`.
--- 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)