From: Mike Bayer Date: Thu, 17 Jan 2008 16:24:26 +0000 (+0000) Subject: check for session is none, [ticket:940] X-Git-Tag: rel_0_4_3~99 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6d486fb2e77e338ac4d45ff5ed45561abb5c81b3;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git check for session is none, [ticket:940] --- diff --git a/CHANGES b/CHANGES index af2101e5da..246853b3d9 100644 --- a/CHANGES +++ b/CHANGES @@ -51,6 +51,8 @@ CHANGES - fixed a rather expensive call in Query that was slowing down polymorphic queries + + - miscellaneous tickets: [ticket:940] - general - warnings are now issued as type exceptions.SAWarning. diff --git a/lib/sqlalchemy/orm/session.py b/lib/sqlalchemy/orm/session.py index 0d58a52161..e2bc71b92e 100644 --- a/lib/sqlalchemy/orm/session.py +++ b/lib/sqlalchemy/orm/session.py @@ -1141,7 +1141,7 @@ def object_session(instance): hashkey = getattr(instance, '_sa_session_id', None) if hashkey is not None: sess = _sessions.get(hashkey) - if instance in sess: + if sess is not None and instance in sess: return sess return None