pyramid_cubicweb/bwcompat.py
changeset 11539 ff581d66f682
parent 11537 caf268942436
child 11575 97110b4af42f
equal deleted inserted replaced
11538:c8f42c41f38c 11539:ff581d66f682
     6 import cubicweb
     6 import cubicweb
     7 import cubicweb.web
     7 import cubicweb.web
     8 
     8 
     9 from cubicweb.web.application import CubicWebPublisher
     9 from cubicweb.web.application import CubicWebPublisher
    10 
    10 
    11 from cubicweb.web import LogOut, cors
    11 from cubicweb.web import LogOut
    12 
    12 
    13 from pyramid_cubicweb.core import cw_to_pyramid
    13 from pyramid_cubicweb.core import cw_to_pyramid
    14 
    14 
    15 
    15 
    16 class PyramidSessionHandler(object):
    16 class PyramidSessionHandler(object):
    55 
    55 
    56         try:
    56         try:
    57             content = None
    57             content = None
    58             try:
    58             try:
    59                 with cw_to_pyramid(request):
    59                 with cw_to_pyramid(request):
    60                     ctrlid, rset = self.appli.url_resolver.process(req, req.path)
    60                     ctrlid, rset = self.appli.url_resolver.process(req,
       
    61                                                                    req.path)
    61 
    62 
    62                     try:
    63                     try:
    63                         controller = vreg['controllers'].select(
    64                         controller = vreg['controllers'].select(
    64                             ctrlid, req, appli=self.appli)
    65                             ctrlid, req, appli=self.appli)
    65                     except cubicweb.NoSelectableObject:
    66                     except cubicweb.NoSelectableObject:
    67                             req._('not authorized'))
    68                             req._('not authorized'))
    68 
    69 
    69                     req.update_search_state()
    70                     req.update_search_state()
    70                     content = controller.publish(rset=rset)
    71                     content = controller.publish(rset=rset)
    71 
    72 
    72                     # XXX this auto-commit should be handled by the cw_request cleanup
    73                     # XXX this auto-commit should be handled by the cw_request
    73                     # or the pyramid transaction manager.
    74                     # cleanup or the pyramid transaction manager.
    74                     # It is kept here to have the ValidationError handling bw
    75                     # It is kept here to have the ValidationError handling bw
    75                     # compatible
    76                     # compatible
    76                     if req.cnx:
    77                     if req.cnx:
    77                         txuuid = req.cnx.commit()
    78                         txuuid = req.cnx.commit()
    78                         # commited = True
    79                         # commited = True