# HG changeset patch # User Christophe de Vienne # Date 1437740473 -7200 # Node ID 50e1fda83837ccf91827a3f504695d57911ae717 # Parent 18dd303225cd3b37ab4ee5a39353201a5113c444 [bwcompat] Make the error handler optional Closes #5739625 diff -r 18dd303225cd -r 50e1fda83837 docs/narr/settings.rst --- 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`. diff -r 18dd303225cd -r 50e1fda83837 pyramid_cubicweb/bwcompat.py --- 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)