diff options
author | Sascha Silbe <sascha-pgp@silbe.org> | 2015-11-02 10:33:37 (GMT) |
---|---|---|
committer | Sascha Silbe <sascha-pgp@silbe.org> | 2015-11-02 10:33:37 (GMT) |
commit | f94f922497fa7659a98ace96f56a88196a1b3c81 (patch) | |
tree | fc0210b5b6abe6472dfeb465ce16ebb303c6631c | |
parent | d22ae3e8c80e828cfa2dff04efb73e2c1eda79ba (diff) |
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().
-rw-r--r-- | gdatastore/datastore.py | 1 |
1 files changed, 1 insertions, 0 deletions
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, |