Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/carquinyol/datastore.py
diff options
context:
space:
mode:
authorAndrés Ambrois <andresambrois@gmail.com>2010-08-24 05:18:44 (GMT)
committer Aleksey Lim <alsroot@member.fsf.org>2010-08-24 16:01:47 (GMT)
commitfaa9974381f5ad70307e6c394d096b56134391e7 (patch)
tree417faa95843951e19e35794eced889c08cc6aab2 /src/carquinyol/datastore.py
parentf3f71c3dad6fdf3b69b3624a6a584002c4c4fb28 (diff)
Add creation_time property.
Diffstat (limited to 'src/carquinyol/datastore.py')
-rw-r--r--src/carquinyol/datastore.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/carquinyol/datastore.py b/src/carquinyol/datastore.py
index 2c0a7f0..fb999b2 100644
--- a/src/carquinyol/datastore.py
+++ b/src/carquinyol/datastore.py
@@ -167,6 +167,17 @@ class DataStore(dbus.service.Object):
if not props.get('timestamp', ''):
props['timestamp'] = int(time.time())
+ # FIXME: Support for the deprecated ctime property. Remove in 0.92.
+ if 'ctime' in props:
+ try:
+ props['creation_time'] = time.mktime(time.strptime(
+ migration.DATE_FORMAT, props['ctime']))
+ except (TypeError, ValueError):
+ pass
+
+ if 'creation_time' not in props:
+ props['creation_time'] = time.time()
+
if os.path.exists(file_path):
stat = os.stat(file_path)
props['filesize'] = stat.st_size
@@ -209,6 +220,17 @@ class DataStore(dbus.service.Object):
if not props.get('timestamp', ''):
props['timestamp'] = int(time.time())
+ # FIXME: Support for the deprecated ctime property. Remove in 0.92.
+ if 'ctime' in props:
+ try:
+ props['creation_time'] = time.mktime(time.strptime(
+ migration.DATE_FORMAT, props['ctime']))
+ except (TypeError, ValueError):
+ pass
+
+ if 'creation_time' not in props:
+ props['creation_time'] = time.time()
+
if os.path.exists(file_path):
stat = os.stat(file_path)
props['filesize'] = stat.st_size