kopia lustrzana https://gitlab.com/marnanel/chapeau
Remote updates are not partial. In other words, fields which are
not mentioned in a remote update should get deleted. This is rarely important in practice, but we should support it. This commit fixes that problem, but breaks the tests. Thus it lives in a side branch until someone gets around to implementing it. The specific breakage is that AcObject has no __delitem__() method. It probably should have one for completeness, even apart from this particular issue. There should be tests specifically for this problem in test_update.remote_update_not_partial
rodzic
81fb007eb0
commit
db96b6df4a
|
@ -288,6 +288,18 @@ def update(activity, **kwargs):
|
|||
# all properties of "existing" which aren't in
|
||||
# "new_object"
|
||||
|
||||
if not activity.is_local:
|
||||
for f, v in sorted(existing.items()):
|
||||
if f in new_object:
|
||||
continue
|
||||
if f in UNSETTABLE_FIELDS:
|
||||
continue
|
||||
|
||||
logger.debug(' -- removing %s because it wasn\'t specified',
|
||||
f)
|
||||
|
||||
del existing[f]
|
||||
|
||||
existing.save()
|
||||
|
||||
if kwargs.get('send_signal', True):
|
||||
|
|
Ładowanie…
Reference in New Issue