diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-07-22 01:46:41 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-07-22 01:46:41 -0400 |
| commit | ca9029ca9830573c4a5618e5dc01347576d50eb4 (patch) | |
| tree | 680c7622154346c21523c69a0d932a9a91146c24 /lib/sqlalchemy/orm/sync.py | |
| parent | 5b91f627a4e5db44c45254f0cb32ac10d0dfabd0 (diff) | |
| download | sqlalchemy-ca9029ca9830573c4a5618e5dc01347576d50eb4.tar.gz | |
- Moving an o2m object from one collection to
another, or vice versa changing the referenced
object by an m2o, where the foreign key is also a
member of the primary key, will now be more
carefully checked during flush if the change in
value of the foreign key on the "many" side is the
result of a change in the primary key of the "one"
side, or if the "one" is just a different object.
In one case, a cascade-capable DB would have
cascaded the value already and we need to look at
the "new" PK value to do an UPDATE, in the other we
need to continue looking at the "old". We now look
at the "old", assuming passive_updates=True,
unless we know it was a PK switch that
triggered the change. [ticket:1856]
Diffstat (limited to 'lib/sqlalchemy/orm/sync.py')
| -rw-r--r-- | lib/sqlalchemy/orm/sync.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/sync.py b/lib/sqlalchemy/orm/sync.py index 184ae8c84..3b2a291bd 100644 --- a/lib/sqlalchemy/orm/sync.py +++ b/lib/sqlalchemy/orm/sync.py @@ -11,7 +11,7 @@ between instances based on join conditions. from sqlalchemy.orm import exc, util as mapperutil def populate(source, source_mapper, dest, dest_mapper, - synchronize_pairs, uowcommit, passive_updates): + synchronize_pairs, uowcommit, flag_cascaded_pks): for l, r in synchronize_pairs: try: value = source_mapper._get_state_attr_by_column(source, source.dict, l) @@ -29,7 +29,7 @@ def populate(source, source_mapper, dest, dest_mapper, # reasons, since we only need this info for a primary key # destination. if l.primary_key and r.primary_key and \ - r.references(l) and passive_updates: + r.references(l) and flag_cascaded_pks: uowcommit.attributes[("pk_cascaded", dest, r)] = True def clear(dest, dest_mapper, synchronize_pairs): |
