Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/gdatastore/datastore.py
diff options
context:
space:
mode:
Diffstat (limited to 'gdatastore/datastore.py')
-rw-r--r--gdatastore/datastore.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/gdatastore/datastore.py b/gdatastore/datastore.py
index 62489a0..4b5064f 100644
--- a/gdatastore/datastore.py
+++ b/gdatastore/datastore.py
@@ -190,14 +190,13 @@ class DBusApiNativeV1(dbus.service.Object):
"""
- add a new version with the given ids
- there must be no existing entry with the same (tree_id, version_id)
- - if parent_id = '', there must be no existing entry with the same tree_id and no parent_id
"""
if not tree_id:
raise ValueError('No tree_id given')
metadata['version_id'] = version_id
self._internal_api.save(tree_id, parent_id, metadata, data_path,
- delete_after=True,
+ delete_after=True, allow_new_parent=True,
async_cb=async_cb,
async_err_cb=async_err_cb)
@@ -478,7 +477,7 @@ class InternalApi(object):
return self._index.retrieve(object_id)
def save(self, tree_id, parent_id, metadata, path, delete_after, async_cb,
- async_err_cb):
+ async_err_cb, allow_new_parent=False):
logging.debug('save(%r, %r, %r, %r, %r)', tree_id, parent_id,
metadata, path, delete_after)
@@ -493,7 +492,7 @@ class InternalApi(object):
if (not tree_id) and parent_id:
raise ValueError('tree_id is empty but parent_id is not')
- if tree_id and not parent_id:
+ if tree_id and not parent_id and not allow_new_parent:
if self.find({'tree_id': tree_id}, {'limit': 1})[1]:
raise ValueError('No parent_id given but tree_id already '
'exists')