git://git.onelab.eu
/
monitor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix for session.clear for newer versions of SQLAlchemy.
[monitor.git]
/
web
/
MonitorWeb
/
monitorweb
/
monitor_xmlrpc.py
diff --git
a/web/MonitorWeb/monitorweb/monitor_xmlrpc.py
b/web/MonitorWeb/monitorweb/monitor_xmlrpc.py
index
026a9ae
..
7d04c48
100644
(file)
--- a/
web/MonitorWeb/monitorweb/monitor_xmlrpc.py
+++ b/
web/MonitorWeb/monitorweb/monitor_xmlrpc.py
@@
-98,7
+98,10
@@
class MonitorXmlrpcServer(object):
if method is None or not getattr(method, "exposed", False):
raise AssertionError("method does not exist")
if method is None or not getattr(method, "exposed", False):
raise AssertionError("method does not exist")
- session.expunge_all()
+ try:
+ session.expunge_all()
+ except AttributeError: # SQLAlchemy < 0.5.1
+ session.clear()
# Call the method, convert it into a 1-element tuple
# as expected by dumps
response = method(*params)
# Call the method, convert it into a 1-element tuple
# as expected by dumps
response = method(*params)