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
Marnanel Thurman 2019-12-01 20:56:05 +00:00
rodzic 81fb007eb0
commit db96b6df4a
1 zmienionych plików z 12 dodań i 0 usunięć

Wyświetl plik

@ -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):