pyramid_cubicweb/bwcompat.py
changeset 11619 be13b3ea71de
parent 11615 7e798fe70014
equal deleted inserted replaced
11618:3dad592ccb8f 11619:be13b3ea71de
     1 import sys
     1 import sys
       
     2 import logging
     2 
     3 
     3 from pyramid import security
     4 from pyramid import security
     4 from pyramid import tweens
     5 from pyramid import tweens
     5 from pyramid.httpexceptions import HTTPSeeOther
     6 from pyramid.httpexceptions import HTTPSeeOther
     6 from pyramid import httpexceptions
     7 from pyramid import httpexceptions
    12 from cubicweb.web.application import CubicWebPublisher
    13 from cubicweb.web.application import CubicWebPublisher
    13 
    14 
    14 from cubicweb.web import LogOut, PublishException
    15 from cubicweb.web import LogOut, PublishException
    15 
    16 
    16 from pyramid_cubicweb.core import cw_to_pyramid
    17 from pyramid_cubicweb.core import cw_to_pyramid
       
    18 
       
    19 
       
    20 log = logging.getLogger(__name__)
    17 
    21 
    18 
    22 
    19 class PyramidSessionHandler(object):
    23 class PyramidSessionHandler(object):
    20     """A CW Session handler that rely on the pyramid API to fetch the needed
    24     """A CW Session handler that rely on the pyramid API to fetch the needed
    21     informations.
    25     informations.
   143                 errview = vreg['views'].select('error', req)
   147                 errview = vreg['views'].select('error', req)
   144                 template = self.appli.main_template_id(req)
   148                 template = self.appli.main_template_id(req)
   145                 content = vreg['views'].main_template(req, template, view=errview)
   149                 content = vreg['views'].main_template(req, template, view=errview)
   146             except Exception:
   150             except Exception:
   147                 content = vreg['views'].main_template(req, 'error-template')
   151                 content = vreg['views'].main_template(req, 'error-template')
       
   152         log.exception(exc)
   148         request.response.body = content
   153         request.response.body = content
   149         return request.response
   154         return request.response
   150 
   155 
   151 
   156 
   152 class TweenHandler(object):
   157 class TweenHandler(object):