Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Belgian Biodiversity Platform
cputils
Commits
148df595
Commit
148df595
authored
Apr 23, 2014
by
Julien Cigar
Browse files
some cleanup
parent
d30cabd8
Changes
2
Hide whitespace changes
Inline
Side-by-side
plugins/sa_plugin.py
View file @
148df595
...
...
@@ -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
...
...
tools/sa_tool.py
View file @
148df595
...
...
@@ -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
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment