From f94f922497fa7659a98ace96f56a88196a1b3c81 Mon Sep 17 00:00:00 2001 From: Sascha Silbe Date: Mon, 02 Nov 2015 10:33:37 +0000 Subject: Sugar v2 API: Fix updating entries containing version_id in metadata A caller using the Sugar v2 D-Bus API is usually unaware of version support. When updating an entry, they might pass through all metadata unchanged, including version_id. When data got updated (not just metadata), this version_id property previously was passed through to InternalApi.save(). The latter uses any passed-in version_id property as the intended child id (e.g. for restoring from backups, or for allocating ids on the caller side). Since the version_id was that of the parent entry, InternalApi.save() bailed out with an error. Fix this by dropping any version_id property in DBusApiSugarV2.update() prior to calling InternalApi.save(). --- diff --git a/gdatastore/datastore.py b/gdatastore/datastore.py index cdd1d3c..bb4e1b1 100644 --- a/gdatastore/datastore.py +++ b/gdatastore/datastore.py @@ -397,6 +397,7 @@ class DBusApiSugarV2(dbus.service.Object): self._internal_api.change_metadata(object_id, props) return success_cb(uid, None) + props.pop('version_id', None) self._internal_api.save(tree_id=uid, parent_id=parent['version_id'], metadata=props, path=file_path.encode('utf-8'), delete_after=transfer_ownership, -- cgit v0.9.1