diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-06-17 18:48:17 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-06-17 19:42:43 -0400 |
| commit | 7f82168cb6b0f0e22d387ffeca1ae82f526c2f29 (patch) | |
| tree | 1ef9195524e6de9fc1e49e07795398538ac20043 /lib/sqlalchemy/orm/properties.py | |
| parent | 42d58f8b6e67c01827f1eed283e23067bbdb848d (diff) | |
| download | sqlalchemy-7f82168cb6b0f0e22d387ffeca1ae82f526c2f29.tar.gz | |
- rework PropComparator.adapted() to be PropComparator.adapt_to_entity(),
passes in AliasedInsp and allows more flexibility.
- rework the AliasedClass/AliasedInsp relationship so that AliasedInsp has
all state and functionality. AliasedClass is just a facade.
[ticket:2756]
Diffstat (limited to 'lib/sqlalchemy/orm/properties.py')
| -rw-r--r-- | lib/sqlalchemy/orm/properties.py | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/lib/sqlalchemy/orm/properties.py b/lib/sqlalchemy/orm/properties.py index 8c0576527..5986556db 100644 --- a/lib/sqlalchemy/orm/properties.py +++ b/lib/sqlalchemy/orm/properties.py @@ -355,27 +355,21 @@ class RelationshipProperty(StrategizedProperty): _of_type = None - def __init__(self, prop, parentmapper, of_type=None, adapter=None): + def __init__(self, prop, parentmapper, adapt_to_entity=None, of_type=None): """Construction of :class:`.RelationshipProperty.Comparator` is internal to the ORM's attribute mechanics. """ self.prop = prop self._parentmapper = parentmapper - self.adapter = adapter + self._adapt_to_entity = adapt_to_entity if of_type: self._of_type = of_type - def adapted(self, adapter): - """Return a copy of this PropComparator which will use the - given adaption function on the local side of generated - expressions. - - """ - + def adapt_to_entity(self, adapt_to_entity): return self.__class__(self.property, self._parentmapper, - getattr(self, '_of_type', None), - adapter) + adapt_to_entity=adapt_to_entity, + of_type=self._of_type) @util.memoized_property def mapper(self): @@ -427,7 +421,8 @@ class RelationshipProperty(StrategizedProperty): return RelationshipProperty.Comparator( self.property, self._parentmapper, - cls, adapter=self.adapter) + adapt_to_entity=self._adapt_to_entity, + of_type=cls) def in_(self, other): """Produce an IN clause - this is not implemented |
