Added object update to the datastore.

This commit is contained in:
Tomeu Vizoso
2007-03-04 11:27:33 +01:00
parent 559d21d4d2
commit a585221b16
2 changed files with 15 additions and 36 deletions
+8 -4
View File
@@ -91,10 +91,14 @@ def write(obj):
metadata = obj.get_metadata().copy()
metadata['file-path'] = obj.get_file_path()
metadata['object-type'] = obj.get_object_type()
logging.debug(str(metadata))
object_path = _data_store.create(dbus.Dictionary(metadata))
dbus_object = _bus.get_object(DS_DBUS_SERVICE, object_path)
return dbus_object.get_properties(['handle'])['handle']
if obj.get_handle():
_data_store.update(int(obj.get_handle()), dbus.Dictionary(metadata))
return obj.get_handle()
else:
object_path = _data_store.create(dbus.Dictionary(metadata))
dbus_object = _bus.get_object(DS_DBUS_SERVICE, object_path)
return dbus_object.get_properties(['handle'])['handle']
def find(query):
object_paths = _data_store.find(query)