summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/engine
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/engine')
-rw-r--r--lib/sqlalchemy/engine/base.py10
-rw-r--r--lib/sqlalchemy/engine/threadlocal.py20
2 files changed, 13 insertions, 17 deletions
diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py
index 7b6ff5b7a..8d1138316 100644
--- a/lib/sqlalchemy/engine/base.py
+++ b/lib/sqlalchemy/engine/base.py
@@ -1554,7 +1554,7 @@ class EngineEvents(event.Events):
if issubclass(target.Connection, Connection):
target.Connection = _proxy_connection_cls(
Connection,
- target.events)
+ target.dispatch)
event.Events.listen(fn, identifier, target)
def on_execute(self, conn, execute, clauseelement, *multiparams, **params):
@@ -1627,7 +1627,7 @@ class Engine(Connectable, log.Identified):
self.update_execution_options(**execution_options)
- events = event.dispatcher(EngineEvents)
+ dispatch = event.dispatcher(EngineEvents)
def update_execution_options(self, **opt):
"""update the execution_options dictionary of this :class:`Engine`.
@@ -1851,11 +1851,7 @@ def _proxy_connection_cls(cls, dispatch):
return orig
def go(*arg, **kw):
nested = _exec_recursive(conn, fns[1:], orig)
- try:
- ret = fns[0](conn, nested, *arg, **kw)
- except IndexError:
- import pdb
- pdb.set_trace()
+ ret = fns[0](conn, nested, *arg, **kw)
# TODO: need to get consistent way to check
# for "they called the fn, they didn't", or otherwise
# make some decision here how this is to work
diff --git a/lib/sqlalchemy/engine/threadlocal.py b/lib/sqlalchemy/engine/threadlocal.py
index 785c6e96a..b6e687b7c 100644
--- a/lib/sqlalchemy/engine/threadlocal.py
+++ b/lib/sqlalchemy/engine/threadlocal.py
@@ -27,7 +27,15 @@ class TLConnection(base.Connection):
self.__opencount = 0
base.Connection.close(self)
-
+class TLEvents(base.EngineEvents):
+ @classmethod
+ def listen(cls, fn, identifier, target):
+ if issubclass(target.TLConnection, TLConnection):
+ target.TLConnection = base._proxy_connection_cls(
+ TLConnection,
+ target.dispatch)
+ base.EngineEvents.listen(fn, identifier, target)
+
class TLEngine(base.Engine):
"""An Engine that includes support for thread-local managed transactions."""
@@ -37,15 +45,7 @@ class TLEngine(base.Engine):
super(TLEngine, self).__init__(*args, **kwargs)
self._connections = util.threading.local()
- class events(base.Engine.events):
- @classmethod
- def listen(cls, fn, identifier, target):
- if issubclass(target.TLConnection, TLConnection):
- target.TLConnection = base._proxy_connection_cls(
- TLConnection,
- target.events)
- base.Engine.events.listen(fn, identifier, target)
- events = event.dispatcher(events)
+ dispatch = event.dispatcher(TLEvents)
def contextual_connect(self, **kw):
if not hasattr(self._connections, 'conn'):