diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-06-23 14:45:47 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-06-23 14:45:47 -0400 |
commit | 0efac1d93e27220f2aa1ec09b282fb08a7bb02be (patch) | |
tree | dbd806874a223253d0c8f52465a77f7e0754c7a8 /lib/sqlalchemy/orm/dynamic.py | |
parent | df62f4501ee1ec37113477eb6a97068cc07faf5d (diff) | |
download | sqlalchemy-0efac1d93e27220f2aa1ec09b282fb08a7bb02be.tar.gz |
- move all of orm to use absolute imports
- break out key mechanics of loading objects
into new "orm.loading" module, removing implementation
details from both mapper.py and query.py. is analogous
to persistence.py
- some other cleanup and old cruft removal
Diffstat (limited to 'lib/sqlalchemy/orm/dynamic.py')
-rw-r--r-- | lib/sqlalchemy/orm/dynamic.py | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/lib/sqlalchemy/orm/dynamic.py b/lib/sqlalchemy/orm/dynamic.py index 18fc76aa9..c2f4aff02 100644 --- a/lib/sqlalchemy/orm/dynamic.py +++ b/lib/sqlalchemy/orm/dynamic.py @@ -11,16 +11,13 @@ basic add/delete mutation. """ -from sqlalchemy import log, util -from sqlalchemy import exc as sa_exc -from sqlalchemy.orm import exc as orm_exc -from sqlalchemy.sql import operators -from sqlalchemy.orm import ( - attributes, object_session, util as mapperutil, strategies, object_mapper +from .. import log, util +from ..sql import operators +from . import ( + attributes, object_session, util as orm_util, strategies, + object_mapper, exc as orm_exc, collections ) -from sqlalchemy.orm.query import Query -from sqlalchemy.orm.util import has_identity -from sqlalchemy.orm import attributes, collections +from .query import Query class DynaLoader(strategies.AbstractRelationshipLoader): def init_class_attribute(self, mapper): @@ -199,7 +196,7 @@ class AppenderMixin(object): query_class = None def __init__(self, attr, state): - Query.__init__(self, attr.target_mapper, None) + super(AppenderMixin, self).__init__(attr.target_mapper, None) self.instance = instance = state.obj() self.attr = attr @@ -219,7 +216,7 @@ class AppenderMixin(object): if sess is not None and self.autoflush and sess.autoflush \ and self.instance in sess: sess.flush() - if not has_identity(self.instance): + if not orm_util.has_identity(self.instance): return None else: return sess @@ -268,7 +265,7 @@ class AppenderMixin(object): "Parent instance %s is not bound to a Session, and no " "contextual session is established; lazy load operation " "of attribute '%s' cannot proceed" % ( - mapperutil.instance_str(instance), self.attr.key)) + orm_util.instance_str(instance), self.attr.key)) if self.query_class: query = self.query_class(self.attr.target_mapper, session=sess) |