diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2018-02-27 13:15:10 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2018-09-27 17:09:28 -0400 |
| commit | 6446e0dfd3e3bb60754bad81c4d52345733d94e3 (patch) | |
| tree | 217e2183a984170c15db799baa3f79dda0da379d /lib/sqlalchemy/orm | |
| parent | d945ee87a1934cb689066e4683ba9531d803f9ad (diff) | |
| download | sqlalchemy-6446e0dfd3e3bb60754bad81c4d52345733d94e3.tar.gz | |
Break association proxy into a descriptor + per-class accessor
Reworked :class:`.AssociationProxy` to store state that's specific to a
parent class in a separate object, so that a single
:class:`.AssocationProxy` can serve for multiple parent classes, as is
intrinsic to inheritance, without any ambiguity in the state returned by it.
A new method :meth:`.AssociationProxy.for_class` is added to allow
inspection of class-specific state.
Change-Id: I634f88aae6306ac5c5237a0e1acbe07d0481d6b6
Fixes: #3423
Diffstat (limited to 'lib/sqlalchemy/orm')
| -rw-r--r-- | lib/sqlalchemy/orm/instrumentation.py | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/lib/sqlalchemy/orm/instrumentation.py b/lib/sqlalchemy/orm/instrumentation.py index 1b839cf5c..d34326e0f 100644 --- a/lib/sqlalchemy/orm/instrumentation.py +++ b/lib/sqlalchemy/orm/instrumentation.py @@ -115,41 +115,6 @@ class ClassManager(dict): # raises unless self.mapper has been assigned raise exc.UnmappedClassError(self.class_) - def _locate_owning_manager(self, attribute): - """Scan through all instrumented classes in our hierarchy - searching for the given object as an attribute, and return - the bottommost owner. - - E.g.:: - - foo = foobar() - - class Parent: - attr = foo - - class Child(Parent): - pass - - Child.manager._locate_owning_manager(foo) would - give us Parent. - - Needed by association proxy to correctly figure out the - owning class when the attribute is accessed. - - """ - - stack = [None] - for supercls in self.class_.__mro__: - mgr = manager_of_class(supercls) - if not mgr: - continue - for key in set(supercls.__dict__): - val = supercls.__dict__[key] - if val is attribute: - stack.append(mgr) - continue - return stack[-1] - def _all_sqla_attributes(self, exclude=None): """return an iterator of all classbound attributes that are implement :class:`.InspectionAttr`. |
