You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
415 B
Python
15 lines
415 B
Python
from apistar.http import Response
|
|
from .component import Session, DBSession
|
|
|
|
class SQLAlchemyHook:
|
|
def on_request(self, session: Session):
|
|
return
|
|
|
|
def on_response(self, session: Session, response: Response):
|
|
DBSession.remove()
|
|
return response
|
|
|
|
def on_error(self, session: Session, response: Response):
|
|
session.rollback()
|
|
DBSession.remove()
|
|
return response |