diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-10-25 20:28:03 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-10-25 20:28:03 -0400 |
| commit | 7f043a9666eecdecc54fe779ffdd50a7d5bb0086 (patch) | |
| tree | 945a98439e89265422632d20289babbe3079f7b1 /lib/sqlalchemy/orm/interfaces.py | |
| parent | 519c705317e801d714bd05a28f8b2786695d81cc (diff) | |
| download | sqlalchemy-7f043a9666eecdecc54fe779ffdd50a7d5bb0086.tar.gz | |
- some naming changes on PropComparator, Comparator:
1. all Comparators now have "parent" which is always the parent mapper
or AliasedClass instance
2. only RelationshipProperty.Comparator has "mapper" now, which
is the target mapper
3. The names "parententity" and "parentmapper" are underscored
also improved the message with the "neither comparator nor instruentedattribute...."
to include the classname + attribute name
Diffstat (limited to 'lib/sqlalchemy/orm/interfaces.py')
| -rw-r--r-- | lib/sqlalchemy/orm/interfaces.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/sqlalchemy/orm/interfaces.py b/lib/sqlalchemy/orm/interfaces.py index 272d4edd5..b30630434 100644 --- a/lib/sqlalchemy/orm/interfaces.py +++ b/lib/sqlalchemy/orm/interfaces.py @@ -305,11 +305,12 @@ class PropComparator(operators.ColumnOperators): """ - def __init__(self, prop, mapper, adapter=None): + def __init__(self, prop, parentmapper, adapter=None): self.prop = self.property = prop - self.mapper = mapper + self._parentmapper = parentmapper self.adapter = adapter + def __clause_element__(self): raise NotImplementedError("%r" % self) @@ -319,7 +320,7 @@ class PropComparator(operators.ColumnOperators): """ - return self.__class__(self.prop, self.mapper, adapter) + return self.__class__(self.prop, self._parentmapper, adapter) @staticmethod def any_op(a, b, **kwargs): @@ -503,7 +504,7 @@ class PropertyOption(MapperOption): d['key'] = ret = [] for token in util.to_list(self.key): if isinstance(token, PropComparator): - ret.append((token.mapper.class_, token.key)) + ret.append((token._parentmapper.class_, token.key)) else: ret.append(token) return d @@ -628,7 +629,7 @@ class PropertyOption(MapperOption): # matching tokens to entities if current_path: if current_path[0:2] == \ - [token.parententity, prop.key]: + [token._parententity, prop.key]: current_path = current_path[2:] continue else: @@ -638,7 +639,7 @@ class PropertyOption(MapperOption): entity = self._find_entity_prop_comparator( query, prop.key, - token.parententity, + token._parententity, raiseerr) if not entity: return no_result |
