summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/util.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/orm/util.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/orm/util.py')
-rw-r--r--lib/sqlalchemy/orm/util.py72
1 files changed, 0 insertions, 72 deletions
diff --git a/lib/sqlalchemy/orm/util.py b/lib/sqlalchemy/orm/util.py
index 8ec161e99..c2b79666c 100644
--- a/lib/sqlalchemy/orm/util.py
+++ b/lib/sqlalchemy/orm/util.py
@@ -185,78 +185,6 @@ def identity_key(*args, **kwargs):
mapper = object_mapper(instance)
return mapper.identity_key_from_instance(instance)
-class ExtensionCarrier(dict):
- """Fronts an ordered collection of MapperExtension objects.
-
- Bundles multiple MapperExtensions into a unified callable unit,
- encapsulating ordering, looping and EXT_CONTINUE logic. The
- ExtensionCarrier implements the MapperExtension interface, e.g.::
-
- carrier.after_insert(...args...)
-
- The dictionary interface provides containment for implemented
- method names mapped to a callable which executes that method
- for participating extensions.
-
- """
-
- interface = set(method for method in dir(MapperExtension)
- if not method.startswith('_'))
-
- def __init__(self, extensions=None):
- self._extensions = []
- for ext in extensions or ():
- self.append(ext)
-
- def copy(self):
- return ExtensionCarrier(self._extensions)
-
- def push(self, extension):
- """Insert a MapperExtension at the beginning of the collection."""
- self._register(extension)
- self._extensions.insert(0, extension)
-
- def append(self, extension):
- """Append a MapperExtension at the end of the collection."""
- self._register(extension)
- self._extensions.append(extension)
-
- def __iter__(self):
- """Iterate over MapperExtensions in the collection."""
- return iter(self._extensions)
-
- def _register(self, extension):
- """Register callable fronts for overridden interface methods."""
-
- for method in self.interface.difference(self):
- impl = getattr(extension, method, None)
- if impl and impl is not getattr(MapperExtension, method):
- self[method] = self._create_do(method)
-
- def _create_do(self, method):
- """Return a closure that loops over impls of the named method."""
-
- def _do(*args, **kwargs):
- for ext in self._extensions:
- ret = getattr(ext, method)(*args, **kwargs)
- if ret is not EXT_CONTINUE:
- return ret
- else:
- return EXT_CONTINUE
- _do.__name__ = method
- return _do
-
- @staticmethod
- def _pass(*args, **kwargs):
- return EXT_CONTINUE
-
- def __getattr__(self, key):
- """Delegate MapperExtension methods to bundled fronts."""
-
- if key not in self.interface:
- raise AttributeError(key)
- return self.get(key, self._pass)
-
class ORMAdapter(sql_util.ColumnAdapter):
"""Extends ColumnAdapter to accept ORM entities.