diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-12-18 05:40:06 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-12-18 05:40:06 +0000 |
commit | faf4aca165cef9bbd8d90b7a4f4ccf2b3d986ea1 (patch) | |
tree | 7c7f6a817a40576ae4650232c84d88b5383c98f0 /lib/sqlalchemy/engine/threadlocal.py | |
parent | f6068a3522bb92fac18c930eb26798fc4cb1889f (diff) | |
download | sqlalchemy-faf4aca165cef9bbd8d90b7a4f4ccf2b3d986ea1.tar.gz |
- cleanup; lambdas removed from properties; properties mirror same-named functions (more like eventual decorator syntax); remove some old methods, factor out some "raiseerr" ugliness to outer lying functions.
- corresponding_column() integrates "require_embedded" flag with other set arithmetic
Diffstat (limited to 'lib/sqlalchemy/engine/threadlocal.py')
-rw-r--r-- | lib/sqlalchemy/engine/threadlocal.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/sqlalchemy/engine/threadlocal.py b/lib/sqlalchemy/engine/threadlocal.py index f2b950f2e..6122b61b2 100644 --- a/lib/sqlalchemy/engine/threadlocal.py +++ b/lib/sqlalchemy/engine/threadlocal.py @@ -93,7 +93,9 @@ class TLConnection(base.Connection): self.__session = session self.__opencount = 1 - session = property(lambda s:s.__session) + def session(self): + return self.__session + session = property(session) def _increment_connect(self): self.__opencount += 1 @@ -132,8 +134,13 @@ class TLTransaction(base.Transaction): self._trans = trans self._session = session - connection = property(lambda s:s._trans.connection) - is_active = property(lambda s:s._trans.is_active) + def connection(self): + return self._trans.connection + connection = property(connection) + + def is_active(self): + return self._trans.is_active + is_active = property(is_active) def rollback(self): self._session.rollback() @@ -168,12 +175,13 @@ class TLEngine(base.Engine): super(TLEngine, self).__init__(*args, **kwargs) self.context = util.ThreadLocal() - def _session(self): + def session(self): + "Returns the current thread's TLSession" if not hasattr(self.context, 'session'): self.context.session = TLSession(self) return self.context.session - session = property(_session, doc="Returns the current thread's TLSession") + session = property(session) def contextual_connect(self, **kwargs): """Return a TLConnection which is thread-locally scoped.""" |