Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar/datastore/dbus_helpers.py
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2007-05-16 04:41:45 (GMT)
committer Dan Williams <dcbw@redhat.com>2007-05-16 04:41:45 (GMT)
commite659d15384908dbfa99d5c78f443bb857cc74cfe (patch)
tree52498427bf10f69033cf268584e8cdc2c7fadbd5 /sugar/datastore/dbus_helpers.py
parent28e8b9025e33102b270c2898e5c81a440375f7d0 (diff)
Make datastore find & update operations async
Diffstat (limited to 'sugar/datastore/dbus_helpers.py')
-rw-r--r--sugar/datastore/dbus_helpers.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/sugar/datastore/dbus_helpers.py b/sugar/datastore/dbus_helpers.py
index 68a1a3b..96c2dd4 100644
--- a/sugar/datastore/dbus_helpers.py
+++ b/sugar/datastore/dbus_helpers.py
@@ -54,13 +54,18 @@ def create(properties, filename):
logging.debug('dbus_helpers.create: ' + object_id)
return object_id
-def update(uid, properties, filename):
+def update(uid, properties, filename, reply_handler=None, error_handler=None):
logging.debug('dbus_helpers.update: %s, %s, %s' % (uid, properties, filename))
try:
logging.debug(get_contents(filename))
except UnicodeDecodeError:
pass
- _data_store.update(uid, dbus.Dictionary(properties), filename)
+ if reply_handler and error_handler:
+ _data_store.update(uid, dbus.Dictionary(properties), filename,
+ reply_handler=reply_handler,
+ error_handler=error_handler)
+ else:
+ _data_store.update(uid, dbus.Dictionary(properties), filename)
def get_properties(uid):
props = _data_store.get_properties(uid)
@@ -76,8 +81,12 @@ def get_filename(uid):
pass
return filename
-def find(query):
- return _data_store.find(query)
+def find(query, reply_handler, error_handler):
+ if reply_handler and error_handler:
+ return _data_store.find(query, reply_handler=reply_handler,
+ error_handler=error_handler)
+ else:
+ return _data_store.find(query)
"""