Commit 148df595 authored by Julien Cigar's avatar Julien Cigar
Browse files

some cleanup

parent d30cabd8
......@@ -7,9 +7,6 @@ from sqlalchemy.orm import scoped_session, sessionmaker
__all__ = ['SAEnginePlugin']
if sa_version.split('.') < ['0', '7', '4']:
raise ImportError('Version 0.7.4 or later of SQLAlchemy required.')
class SAEnginePlugin(plugins.SimplePlugin):
"""
SQLAlchemy integration for CherryPy
......
......@@ -10,11 +10,12 @@ class SATool(cherrypy.Tool):
def __init__(self):
super(SATool, self).__init__('on_start_resource', self.bind_session,
priority=20)
self.session = None
def _setup(self):
super(SATool, self)._setup()
cherrypy.serving.request.hooks.attach('on_end_resource',
self.remove_session, priority=80)
cherrypy.request.hooks.attach('on_end_resource',
self.remove_session, priority=80)
def bind_session(self):
self.session = cherrypy.engine.publish('get-session').pop()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment