Session Management Middleware¶
- class falcon_sqla.middleware.Middleware(manager)¶
Falcon middleware that can be used with the session manager.
- Parameters:
manager (Manager) – Manager instance to use in this middleware.
- process_request(req, resp)¶
Set up a SQLAlchemy session for this request.
The session object is stored as
req.context.session
.When the
sticky_binds
option is set toTrue
, areq.context.request_id
identifier is created (if not already present) by calling therequest_id_func
function.
- process_response(req, resp, resource, req_succeeded)¶
Clean up the session, if one was provided.
This response hook finalizes the session by calling its
.commit()
if req_succeeded isTrue
, and.rollback()
otherwise. Finally, it will close the session.