From ab19f19116433362051e988a9e5709018f5c4ad0 Mon Sep 17 00:00:00 2001 From: Benjamin Saller Date: Sun, 22 Jul 2007 17:30:59 +0000 Subject: fix #2381 the new implementation of xapianindex violated the contract with backingstore here based on what the old index layer did. There is a test now covering this case and the issue is fixed --- diff --git a/bin/datastore-service b/bin/datastore-service index 2019793..c84e314 100755 --- a/bin/datastore-service +++ b/bin/datastore-service @@ -74,7 +74,7 @@ def main(): try: while True: context.iteration(False) - time.sleep(0.025) + time.sleep(0.0025) except KeyboardInterrupt: ds.stop() diff --git a/src/olpc/datastore/backingstore.py b/src/olpc/datastore/backingstore.py index f317983..13ec2ee 100644 --- a/src/olpc/datastore/backingstore.py +++ b/src/olpc/datastore/backingstore.py @@ -488,7 +488,7 @@ class InplaceFileBackingStore(FileBackingStore): def get(self, uid, env=None, allowMissing=False): content = self.indexmanager.get(uid) if not content: raise KeyError(uid) - return content.get_property('filename') + return content def update(self, uid, props, filelike=None): # the file would have already been changed inplace diff --git a/src/olpc/datastore/datastore.py b/src/olpc/datastore/datastore.py index d026fce..111548c 100644 --- a/src/olpc/datastore/datastore.py +++ b/src/olpc/datastore/datastore.py @@ -335,11 +335,20 @@ class DataStore(dbus.service.Object): def get(self, uid): mp = self._resolveMountpoint() - c = mp.get(uid) + c = None + try: + c = mp.get(uid) + if c: return c + except KeyError: + pass + if not c: for mp in self.mountpoints.itervalues(): - c = mp.get(uid) - if c: break + try: + c = mp.get(uid) + if c: break + except KeyError: + continue return c #@utils.sanitize_dbus diff --git a/tests/mountpoints.txt b/tests/mountpoints.txt index b89d5cb..2146c71 100644 --- a/tests/mountpoints.txt +++ b/tests/mountpoints.txt @@ -133,5 +133,11 @@ Check for the new value in the descriptor >>> assert mp.descriptor()['title'] == 'Fake USB again' +Verify that we can get the properties of objects on the inplace +stores. + +>>> uid = result[0]['uid'] +>>> assert ds.get_properties(uid)['title'] == "doc4" + >>> ds.stop(); del ds -- cgit v0.9.1