[Sugar-devel] [PATCH sugar-datastore v2] don't choke if timestamp property is missing

Sascha Silbe silbe at activitycentral.com
Tue Feb 15 13:40:40 EST 2011


The timestamp property might be missing due to incomplete writes (out of
power, system crash) or software bugs.

Signed-off-by: Sascha Silbe <silbe at activitycentral.com>
---
v1->v2: ensure we update the metadata on disk

 src/carquinyol/datastore.py |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/carquinyol/datastore.py b/src/carquinyol/datastore.py
index 837de35..41ec2c3 100644
--- a/src/carquinyol/datastore.py
+++ b/src/carquinyol/datastore.py
@@ -140,6 +140,9 @@ class DataStore(dbus.service.Object):
                         if os.path.exists(path):
                             props['filesize'] = os.stat(path).st_size
                             update_metadata = True
+                    if 'timestamp' not in props:
+                        props['timestamp'] = str(int(time.time()))
+                        update_metadata = True
                     if 'creation_time' not in props:
                         if 'ctime' in props:
                             try:
--
1.7.2.3



More information about the Sugar-devel mailing list