Add DSMetadata.get() method.

This commit is contained in:
Tomeu Vizoso 2007-10-03 21:33:34 +02:00
parent 03e6db4393
commit fab9ac8972
2 changed files with 7 additions and 1 deletions

View File

@ -75,6 +75,12 @@ class DSMetadata(gobject.GObject):
def copy(self): def copy(self):
return DSMetadata(self._props.copy()) return DSMetadata(self._props.copy())
def get(self, key, default=None):
if self._props.has_key(key):
return self._props[key]
else:
return default
class DSObject(object): class DSObject(object):
def __init__(self, object_id, metadata=None, file_path=None): def __init__(self, object_id, metadata=None, file_path=None):
self.object_id = object_id self.object_id = object_id

View File

@ -75,7 +75,7 @@ def get_filename(uid):
return filename return filename
def find(query, properties, reply_handler, error_handler): def find(query, properties, reply_handler, error_handler):
logging.debug('dbus_helpers.find: %r' % query) logging.debug('dbus_helpers.find: %r %r' % (query, properties))
if reply_handler and error_handler: if reply_handler and error_handler:
return _get_data_store().find(query, properties, return _get_data_store().find(query, properties,
reply_handler=reply_handler, error_handler=error_handler) reply_handler=reply_handler, error_handler=error_handler)