pyramid_cubicweb/bwcompat.py
changeset 11588 50e1fda83837
parent 11578 fcba04437236
child 11607 5b36399b6b21
equal deleted inserted replaced
11587:18dd303225cd 11588:50e1fda83837
     2 
     2 
     3 from pyramid import security
     3 from pyramid import security
     4 from pyramid import tweens
     4 from pyramid import tweens
     5 from pyramid.httpexceptions import HTTPSeeOther
     5 from pyramid.httpexceptions import HTTPSeeOther
     6 from pyramid import httpexceptions
     6 from pyramid import httpexceptions
       
     7 from pyramid.settings import asbool
     7 
     8 
     8 import cubicweb
     9 import cubicweb
     9 import cubicweb.web
    10 import cubicweb.web
    10 
    11 
    11 from cubicweb.web.application import CubicWebPublisher
    12 from cubicweb.web.application import CubicWebPublisher
   194     config.registry['cubicweb.appli'] = cwappli
   195     config.registry['cubicweb.appli'] = cwappli
   195     config.registry['cubicweb.handler'] = cwhandler
   196     config.registry['cubicweb.handler'] = cwhandler
   196 
   197 
   197     config.add_tween(
   198     config.add_tween(
   198         'pyramid_cubicweb.bwcompat.TweenHandler', under=tweens.EXCVIEW)
   199         'pyramid_cubicweb.bwcompat.TweenHandler', under=tweens.EXCVIEW)
   199     config.add_view(cwhandler.error_handler, context=Exception)
   200     if asbool(config.registry.settings.get(
   200     # XXX why do i need this?
   201             'cubicweb.bwcompat.errorhandler', True)):
   201     config.add_view(cwhandler.error_handler, context=httpexceptions.HTTPForbidden)
   202         config.add_view(cwhandler.error_handler, context=Exception)
       
   203         # XXX why do i need this?
       
   204         config.add_view(cwhandler.error_handler, context=httpexceptions.HTTPForbidden)