diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-07-16 17:29:02 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-07-16 17:29:02 -0400 |
commit | ce9a702dbd52946487f45b98ef20d1b7783facb6 (patch) | |
tree | 7273a1982850bf9975509295d766053d4fe822b1 /lib/sqlalchemy/orm/interfaces.py | |
parent | 1dc09bf6ede97ef08b2c8c0886a03b44bba735ff (diff) | |
download | sqlalchemy-ce9a702dbd52946487f45b98ef20d1b7783facb6.tar.gz |
- express most of the orm.util functions in terms of the inspection system
- modify inspection system:
1. raise a new exception for any case where the inspection
context can't be returned. this supersedes the "not mapped"
errors.
2. don't configure mappers on a mapper inspection. this allows
the inspectors to be used during mapper config time. instead,
the mapper configures on "with_polymorphic_selectable" now,
which is needed for all queries
- add a bunch of new "is_XYZ" attributes to inspectors
- finish making the name change of "compile" -> "configure", for some reason
this was only done partially
Diffstat (limited to 'lib/sqlalchemy/orm/interfaces.py')
-rw-r--r-- | lib/sqlalchemy/orm/interfaces.py | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/sqlalchemy/orm/interfaces.py b/lib/sqlalchemy/orm/interfaces.py index 1b1d7dfa9..1e47e6616 100644 --- a/lib/sqlalchemy/orm/interfaces.py +++ b/lib/sqlalchemy/orm/interfaces.py @@ -55,8 +55,17 @@ MANYTOMANY = util.symbol('MANYTOMANY') from .deprecated_interfaces import AttributeExtension, SessionExtension, \ MapperExtension +class _InspectionAttr(object): + """Define a series of attributes that all ORM inspection + targets need to have.""" -class MapperProperty(object): + is_selectable = False + is_aliased_class = False + is_instance = False + is_mapper = False + is_property = False + +class MapperProperty(_InspectionAttr): """Manage the relationship of a ``Mapper`` to a single class attribute, as well as that attribute as it appears on individual instances of the class, including attribute instrumentation, @@ -77,6 +86,8 @@ class MapperProperty(object): """ + is_property = True + def setup(self, context, entity, path, adapter, **kwargs): """Called by Query for the purposes of constructing a SQL statement. @@ -115,8 +126,8 @@ class MapperProperty(object): def instrument_class(self, mapper): # pragma: no-coverage raise NotImplementedError() - _compile_started = False - _compile_finished = False + _configure_started = False + _configure_finished = False def init(self): """Called after all mappers are created to assemble @@ -124,9 +135,9 @@ class MapperProperty(object): initialization steps. """ - self._compile_started = True + self._configure_started = True self.do_init() - self._compile_finished = True + self._configure_finished = True @property def class_attribute(self): |