pyramid_cubicweb/handler.py
changeset 11485 3905c9f06d0e
parent 11484 39768d122f97
child 11487 04252e9ff549
equal deleted inserted replaced
11484:39768d122f97 11485:3905c9f06d0e
    34         """
    34         """
    35         # XXX In a later version of this handler, we need to by-pass
    35         # XXX In a later version of this handler, we need to by-pass
    36         # core_handle and CubicWebPublisher altogether so that the various CW
    36         # core_handle and CubicWebPublisher altogether so that the various CW
    37         # exceptions are converted to their pyramid equivalent.
    37         # exceptions are converted to their pyramid equivalent.
    38 
    38 
    39         req = request.cw_request()
    39         req = request.cw_request
    40         req.set_cnx(request.cw_cnx)
       
    41 
    40 
    42         # XXX The main handler of CW forbid anonymous https connections
    41         # XXX The main handler of CW forbid anonymous https connections
    43         # I guess we can drop this "feature" but in doubt I leave this comment
    42         # I guess we can drop this "feature" but in doubt I leave this comment
    44         # so we don't forget about it. (cdevienne)
    43         # so we don't forget about it. (cdevienne)
    45 
    44 
    53                 for item in v:
    52                 for item in v:
    54                     request.response.headers.add(k, item)
    53                     request.response.headers.add(k, item)
    55         except LogOut as ex:
    54         except LogOut as ex:
    56             # The actual 'logging out' logic should be in separated function
    55             # The actual 'logging out' logic should be in separated function
    57             # that is accessible by the pyramid views
    56             # that is accessible by the pyramid views
    58             del req._request.session['cubicweb.sessionid']
       
    59             if not req.session.closed:
       
    60                 req.session.repo.close(req.session.sessionid)
       
    61             headers = security.forget(request)
    57             headers = security.forget(request)
    62             raise HTTPSeeOther(ex.url, headers=headers)
    58             raise HTTPSeeOther(ex.url, headers=headers)
    63         except Redirect as ex:
    59         except Redirect as ex:
    64             raise HTTPSeeOther(ex.url)
    60             raise HTTPSeeOther(ex.url)
    65         # except AuthenticationError:
    61         # except AuthenticationError: