summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/engine/base.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-11-10 19:00:28 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2010-11-10 19:00:28 -0500
commit3564ea86e7cd982a353b42be4105a40bdf9415a3 (patch)
treeb1c9369a285e6e290e70c7817869c9326db9a810 /lib/sqlalchemy/engine/base.py
parenta9b270a3ed4faf85f772897a867caf6762ff9160 (diff)
downloadsqlalchemy-3564ea86e7cd982a353b42be4105a40bdf9415a3.tar.gz
- move deprecated interfaces down to bottom of TOC, update verbiage
- more docs for engine, pool, DDL events - update DDL sequences documentation to use events - update DDL() docstring to refer to execute_if() - document parameters for DDLElement.execute_if() - add retval=True flag to Engine.on_before_execute(), on_before_cursor_execute(). wrap the function if retval=False, check for appropriate usage of the flag, add tests. - remove ScopedSession.mapper and tests entirely - remove ExtensionCarrier and tests - change remaining tests that use MapperExtension to use MapperEvents
Diffstat (limited to 'lib/sqlalchemy/engine/base.py')
-rw-r--r--lib/sqlalchemy/engine/base.py49
1 files changed, 25 insertions, 24 deletions
diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py
index ba4ef6037..9d80af7a7 100644
--- a/lib/sqlalchemy/engine/base.py
+++ b/lib/sqlalchemy/engine/base.py
@@ -1887,49 +1887,50 @@ def _listener_connection_cls(cls, dispatch):
"""
class EventListenerConnection(cls):
def execute(self, clauseelement, *multiparams, **params):
- if dispatch.on_before_execute:
- for fn in dispatch.on_before_execute:
- result = fn(self, clauseelement, multiparams, params)
- if result:
- clauseelement, multiparams, params = result
+ for fn in dispatch.on_before_execute:
+ clauseelement, multiparams, params = \
+ fn(self, clauseelement, multiparams, params)
- ret = super(EventListenerConnection, self).execute(clauseelement, *multiparams, **params)
+ ret = super(EventListenerConnection, self).\
+ execute(clauseelement, *multiparams, **params)
- if dispatch.on_after_execute:
- for fn in dispatch.on_after_execute:
- fn(self, clauseelement, multiparams, params, ret)
+ for fn in dispatch.on_after_execute:
+ fn(self, clauseelement, multiparams, params, ret)
return ret
- def _execute_clauseelement(self, clauseelement, multiparams=None, params=None):
- return self.execute(clauseelement, *(multiparams or []), **(params or {}))
+ def _execute_clauseelement(self, clauseelement,
+ multiparams=None, params=None):
+ return self.execute(clauseelement,
+ *(multiparams or []),
+ **(params or {}))
def _cursor_execute(self, cursor, statement,
parameters, context=None):
- if dispatch.on_before_cursor_execute:
- for fn in dispatch.on_before_cursor_execute:
- result = fn(self, cursor, statement, parameters, context, False)
- if result:
- statement, parameters = result
+ for fn in dispatch.on_before_cursor_execute:
+ statement, parameters = \
+ fn(self, cursor, statement, parameters,
+ context, False)
ret = super(EventListenerConnection, self).\
- _cursor_execute(cursor, statement, parameters, context)
+ _cursor_execute(cursor, statement, parameters,
+ context)
- if dispatch.on_after_cursor_execute:
- for fn in dispatch.on_after_cursor_execute:
- fn(self, cursor, statement, parameters, context, False)
+ for fn in dispatch.on_after_cursor_execute:
+ fn(self, cursor, statement, parameters, context, False)
return ret
def _cursor_executemany(self, cursor, statement,
parameters, context=None):
for fn in dispatch.on_before_cursor_execute:
- result = fn(self, cursor, statement, parameters, context, True)
- if result:
- statement, parameters = result
+ statement, parameters = \
+ fn(self, cursor, statement, parameters,
+ context, True)
ret = super(EventListenerConnection, self).\
- _cursor_executemany(cursor, statement, parameters, context)
+ _cursor_executemany(cursor, statement,
+ parameters, context)
for fn in dispatch.on_after_cursor_execute:
fn(self, cursor, statement, parameters, context, True)