summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/engine/threadlocal.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2008-05-09 16:34:10 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2008-05-09 16:34:10 +0000
commit4a6afd469fad170868554bf28578849bf3dfd5dd (patch)
treeb396edc33d567ae19dd244e87137296450467725 /lib/sqlalchemy/engine/threadlocal.py
parent46b7c9dc57a38d5b9e44a4723dad2ad8ec57baca (diff)
downloadsqlalchemy-4a6afd469fad170868554bf28578849bf3dfd5dd.tar.gz
r4695 merged to trunk; trunk now becomes 0.5.
0.4 development continues at /sqlalchemy/branches/rel_0_4
Diffstat (limited to 'lib/sqlalchemy/engine/threadlocal.py')
-rw-r--r--lib/sqlalchemy/engine/threadlocal.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/sqlalchemy/engine/threadlocal.py b/lib/sqlalchemy/engine/threadlocal.py
index e4b2859dc..91b16ed5f 100644
--- a/lib/sqlalchemy/engine/threadlocal.py
+++ b/lib/sqlalchemy/engine/threadlocal.py
@@ -17,7 +17,7 @@ class TLSession(object):
try:
return self.__transaction._increment_connect()
except AttributeError:
- return TLConnection(self, self.engine.pool.connect(), close_with_result=close_with_result)
+ return self.engine.TLConnection(self, self.engine.pool.connect(), close_with_result=close_with_result)
def reset(self):
try:
@@ -81,11 +81,14 @@ class TLSession(object):
class TLConnection(base.Connection):
- def __init__(self, session, connection, close_with_result):
- base.Connection.__init__(self, session.engine, connection, close_with_result=close_with_result)
+ def __init__(self, session, connection, **kwargs):
+ base.Connection.__init__(self, session.engine, connection, **kwargs)
self.__session = session
self.__opencount = 1
+ def _branch(self):
+ return self.engine.Connection(self.engine, self.connection, _branch=True)
+
def session(self):
return self.__session
session = property(session)
@@ -168,6 +171,12 @@ class TLEngine(base.Engine):
super(TLEngine, self).__init__(*args, **kwargs)
self.context = util.ThreadLocal()
+ proxy = kwargs.get('proxy')
+ if proxy:
+ self.TLConnection = base._proxy_connection_cls(TLConnection, proxy)
+ else:
+ self.TLConnection = TLConnection
+
def session(self):
"Returns the current thread's TLSession"
if not hasattr(self.context, 'session'):