Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrés Ambrois <andresambrois@gmail.com>2010-07-02 06:36:56 (GMT)
committer Anish Mangal <anish@sugarlabs.org>2011-08-26 06:19:51 (GMT)
commit9ef4f9665c9f907da5330f5e7d0c1abe46c7b955 (patch)
tree1cc233a010cfca58e15269fd77e31a127f3052d9
parent90f1905b7d83df9cb9a7b3240faad2a6591e49e5 (diff)
Check filesize property on index rebuild.
This will ensure it gets set when upgrading from older datastores. Signed-off-by: Andrés Ambrois <andresambrois@gmail.com> Signed-off-by: Anish Mangal <anish@sugarlabs.org>
-rw-r--r--src/carquinyol/datastore.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/carquinyol/datastore.py b/src/carquinyol/datastore.py
index 44df5a2..2c0a7f0 100644
--- a/src/carquinyol/datastore.py
+++ b/src/carquinyol/datastore.py
@@ -121,7 +121,15 @@ class DataStore(dbus.service.Object):
if not self._index_store.contains(uid):
try:
+ update_metadata = False
props = self._metadata_store.retrieve(uid)
+ if 'filesize' not in props:
+ path = self._file_store.get_file_path(uid)
+ if os.path.exists(path):
+ props['filesize'] = os.stat(path).st_size
+ update_metadata = True
+ if update_metadata:
+ self._metadata_store.store(uid, props)
self._index_store.store(uid, props)
except Exception:
logging.exception('Error processing %r', uid)