[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [pytorctl/master] backward compatibility with SQLAlchemy 0.5.x
commit c8fee8b7b5ea6c584bb5a75647ee44737e60b66d
Author: aagbsn <aagbsn@xxxxxxxx>
Date: Sun Apr 10 23:59:09 2011 -0700
backward compatibility with SQLAlchemy 0.5.x
---
SQLSupport.py | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/SQLSupport.py b/SQLSupport.py
index 2bd0a8f..9e1a4cb 100644
--- a/SQLSupport.py
+++ b/SQLSupport.py
@@ -63,6 +63,10 @@ def setup_db(db_uri, echo=False, drop=False):
# wouldn't kill you, you know.
tc_session.add = tc_session.save_or_update
+ if sqlalchemy.__version__ < "0.6.0":
+ # clear() replaced with expunge_all
+ tc_session.clear = tc_session.expunge_all
+
class Router(Entity):
using_options(shortnames=True, order_by='-published', session=tc_session, metadata=tc_metadata)
using_mapper_options(save_on_init=False)
@@ -374,7 +378,7 @@ class RouterStats(Entity):
_compute_stats = Callable(_compute_stats)
def _compute_ranks():
- tc_session.clear()
+ tc_session.expunge_all()
min_r = select([func.min(BwHistory.rank)],
BwHistory.table.c.router_idhex
== RouterStats.table.c.router_idhex).as_scalar()
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits