Skip to content

Commit

Permalink
Fixes problem with overwriting SC fields by update
Browse files Browse the repository at this point in the history
  • Loading branch information
sirMackk committed Feb 12, 2017
1 parent b29ebb6 commit 90b86c4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions auslib/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -1215,6 +1215,10 @@ def mergeUpdate(self, old_row, what, changed_by, transaction=None):
(meaning: the scheduled change and the new version of the row modify
the same columns), an UpdateMergeError is raised."""

# Filter the update to only include fields that are different than
# what's in the base (old_row).
what = {k: v for k, v in what.items() if v != old_row.get(k)}

# pyflakes thinks this should be "is False", but that's not how SQLAlchemy
# works, so we need to shut it up.
# http://stackoverflow.com/questions/18998010/flake8-complains-on-boolean-comparison-in-filter-clause
Expand Down

0 comments on commit 90b86c4

Please sign in to comment.