Use a sentinel as default value for setting attribute only if changed
For new instances, we must set also the attribute with value `None` as they may be tested later. Closes #15060 (grafted from bfe3756af384f4fce94244761d5f5dd3f62d0ff6) --HG-- branch : 7.0
This commit is contained in:
1 parent
21f549d531
commit
5e211dd515
1 file changed
+1
-1
@@ -160,6 +160,6 @@ class IdentifiersMixin(IdentifiersUpdateMixin):
|
||||
|
||||
|
||||
def setattr_changed(record, name, value):
|
||||
if getattr(record, name, None) != value:
|
||||
if getattr(record, name, object()) != value:
|
||||
setattr(record, name, value)
|
||||
return True
|
||||
Reference in new issue
Block a user