summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/relationships.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-04-26 15:51:29 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2013-04-26 15:51:29 -0400
commite3a7015f8991cea869c6e59cd537fec9836fc9bd (patch)
treefc051a11d664f4fc6b7ab8d0048388ef4f518af1 /lib/sqlalchemy/orm/relationships.py
parent22c4ae0aaf3a00e9020c3950a53d2a3238b2091c (diff)
downloadsqlalchemy-e3a7015f8991cea869c6e59cd537fec9836fc9bd.tar.gz
Fixes to the ``sqlalchemy.ext.serializer`` extension, including
that the "id" passed from the pickler is turned into a string to prevent against bytes being parsed on Py3K, as well as that ``relationship()`` and ``orm.join()`` constructs are now properly serialized. [ticket:2698] and some other observed issues.
Diffstat (limited to 'lib/sqlalchemy/orm/relationships.py')
-rw-r--r--lib/sqlalchemy/orm/relationships.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/relationships.py b/lib/sqlalchemy/orm/relationships.py
index 9e44e01f7..95fa28613 100644
--- a/lib/sqlalchemy/orm/relationships.py
+++ b/lib/sqlalchemy/orm/relationships.py
@@ -835,12 +835,12 @@ class JoinCondition(object):
secondary_aliasizer.traverse(secondaryjoin)
else:
primary_aliasizer = ClauseAdapter(dest_selectable,
- exclude_fn=lambda c: "local" in c._annotations,
+ exclude_fn=_ColInAnnotations("local"),
equivalents=self.child_equivalents)
if source_selectable is not None:
primary_aliasizer.chain(
ClauseAdapter(source_selectable,
- exclude_fn=lambda c: "remote" in c._annotations,
+ exclude_fn=_ColInAnnotations("remote"),
equivalents=self.parent_equivalents))
secondary_aliasizer = None
@@ -895,3 +895,14 @@ class JoinCondition(object):
bind_to_col = dict((binds[col].key, col) for col in binds)
return lazywhere, bind_to_col, equated_columns
+
+class _ColInAnnotations(object):
+ """Seralizable equivalent to:
+
+ lambda c: "name" in c._annotations
+ """
+ def __init__(self, name):
+ self.name = name
+
+ def __call__(self, c):
+ return self.name in c._annotations \ No newline at end of file