summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/attributes.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-06-17 18:48:17 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2013-06-17 19:42:43 -0400
commit7f82168cb6b0f0e22d387ffeca1ae82f526c2f29 (patch)
tree1ef9195524e6de9fc1e49e07795398538ac20043 /lib/sqlalchemy/orm/attributes.py
parent42d58f8b6e67c01827f1eed283e23067bbdb848d (diff)
downloadsqlalchemy-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/attributes.py')
-rw-r--r--lib/sqlalchemy/orm/attributes.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py
index bfba695b8..2627a1c44 100644
--- a/lib/sqlalchemy/orm/attributes.py
+++ b/lib/sqlalchemy/orm/attributes.py
@@ -335,14 +335,14 @@ def create_proxied_attribute(descriptor):
def __init__(self, class_, key, descriptor,
comparator,
- adapter=None, doc=None,
+ adapt_to_entity=None, doc=None,
original_property=None):
self.class_ = class_
self.key = key
self.descriptor = descriptor
self.original_property = original_property
self._comparator = comparator
- self.adapter = adapter
+ self._adapt_to_entity = adapt_to_entity
self.__doc__ = doc
@property
@@ -353,18 +353,15 @@ def create_proxied_attribute(descriptor):
def comparator(self):
if util.callable(self._comparator):
self._comparator = self._comparator()
- if self.adapter:
- self._comparator = self._comparator.adapted(self.adapter)
+ if self._adapt_to_entity:
+ self._comparator = self._comparator.adapt_to_entity(
+ self._adapt_to_entity)
return self._comparator
- def adapted(self, adapter):
- """Proxy adapted() for the use case of AliasedClass calling
- adapted.
-
- """
+ def adapt_to_entity(self, adapt_to_entity):
return self.__class__(self.class_, self.key, self.descriptor,
self._comparator,
- adapter)
+ adapt_to_entity)
def __get__(self, instance, owner):
if instance is None: