diff options
author | Benjamin Saller <bcsaller@objectrealms.net> | 2007-07-04 20:58:54 (GMT) |
---|---|---|
committer | Benjamin Saller <bcsaller@objectrealms.net> | 2007-07-04 20:58:54 (GMT) |
commit | 649ec3d6f8e566d185eea91b22ce5a36b3e93dc1 (patch) | |
tree | 179f3fd511d72e2a1600170a207454a6d2eb5e00 /src/olpc/datastore/datastore.py | |
parent | 3663a1e945a2ab03d731fe183535a04b6261196e (diff) |
fix 1882
patch 1889
Diffstat (limited to 'src/olpc/datastore/datastore.py')
-rw-r--r-- | src/olpc/datastore/datastore.py | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/src/olpc/datastore/datastore.py b/src/olpc/datastore/datastore.py index b4fe356..142d801 100644 --- a/src/olpc/datastore/datastore.py +++ b/src/olpc/datastore/datastore.py @@ -109,6 +109,24 @@ class DataStore(dbus.service.Object): self.mountpoints[mountpoint_id].stop() del self.mountpoints[mountpoint_id] ### End Mount Points + + ### Buddy Management + ## A single datastore typically refers to a single user + ## this breaks down a little in the case of things like USB + ## sticks and so on. We provide a facility for tracking + ## co-authors of content + ## there are associated changes to 'find' to resolve buddies + def addBuddy(self, id, name, fg_color, bg_color): + pass + + def getBuddy(self, id): + pass + + def buddies(self): + pass + + + ## end buddy api def connect_backingstore(self, uri, **kwargs): """ @@ -227,6 +245,13 @@ class DataStore(dbus.service.Object): don't want to generate them unless needed. In the case the the full properties set matches doing the single roundtrip to start an activity makes sense. + + To order results by a given property you can specify: + >>> ds.find(order_by=['author', 'title']) + + Order by must be a list of property names given in the order + of decreasing precedence. + """ # only goes to the primary now. Punting on the merge case if isinstance(query, dict): @@ -234,7 +259,7 @@ class DataStore(dbus.service.Object): include_files = kwargs.pop('include_files', False) order_by = kwargs.pop('order_by', []) - + # distribute the search to all the mountpoints unless a # backingstore id set is specified results, count = self._multiway_search(kwargs) @@ -272,7 +297,6 @@ class DataStore(dbus.service.Object): return 0 - r = results.values() r.sort(comparator) results = r @@ -330,12 +354,13 @@ class DataStore(dbus.service.Object): #@utils.sanitize_dbus @dbus.service.method(DS_DBUS_INTERFACE, - in_signature='s', + in_signature='sa{sv}', out_signature='a{sv}') - def get_properties(self, uid): + def get_properties(self, uid, query=None): content = self.get(uid) dictionary = {} - for prop in content.get_properties(): + if not query: query = {} + for prop in content.get_properties(**query): dictionary[prop.key] = prop.marshall() return dictionary |