diff options
| author | mike bayer <mike_mp@zzzcomputing.com> | 2017-05-10 14:21:33 -0400 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@awstats.zzzcomputing.com> | 2017-05-10 14:21:33 -0400 |
| commit | 7455e7eba903c2df4caf61c4857310f9f0d7cb64 (patch) | |
| tree | fff8310c1217c0e59504f98f9fa542a340d96aef /lib | |
| parent | 3e3554d37ca589218c13f9b2969801dccbbdfa2c (diff) | |
| parent | c4f28097aa6a01efaa02b9792d5d15f33ae6baac (diff) | |
| download | sqlalchemy-7455e7eba903c2df4caf61c4857310f9f0d7cb64.tar.gz | |
Merge "Add conditionals specific to deferred for expire ro properties"
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sqlalchemy/orm/persistence.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/persistence.py b/lib/sqlalchemy/orm/persistence.py index 5dc5a90b1..588a1d696 100644 --- a/lib/sqlalchemy/orm/persistence.py +++ b/lib/sqlalchemy/orm/persistence.py @@ -982,8 +982,16 @@ def _finalize_insert_update_commands(base_mapper, uowtransaction, states): if mapper._readonly_props: readonly = state.unmodified_intersection( - [p.key for p in mapper._readonly_props - if p.expire_on_flush or p.key not in state.dict] + [ + p.key for p in mapper._readonly_props + if ( + p.expire_on_flush and + (not p.deferred or p.key in state.dict) + ) or ( + not p.expire_on_flush and + not p.deferred and p.key not in state.dict + ) + ] ) if readonly: state._expire_attributes(state.dict, readonly) |
