diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sqlalchemy/ext/serializer.py | 5 | ||||
-rw-r--r-- | lib/sqlalchemy/orm/relationships.py | 15 |
2 files changed, 16 insertions, 4 deletions
diff --git a/lib/sqlalchemy/ext/serializer.py b/lib/sqlalchemy/ext/serializer.py index 990483d03..b4c67538a 100644 --- a/lib/sqlalchemy/ext/serializer.py +++ b/lib/sqlalchemy/ext/serializer.py @@ -109,7 +109,8 @@ def Serializer(*args, **kw): pickler.persistent_id = persistent_id return pickler -our_ids = re.compile(r'(mapper|table|column|session|attribute|engine):(.*)') +our_ids = re.compile( + r'(mapperprop|mapper|table|column|session|attribute|engine):(.*)') def Deserializer(file, metadata=None, scoped_session=None, engine=None): @@ -126,7 +127,7 @@ def Deserializer(file, metadata=None, scoped_session=None, engine=None): return None def persistent_load(id): - m = our_ids.match(id) + m = our_ids.match(str(id)) if not m: return None else: 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 |