diff options
Diffstat (limited to 'src/carquinyol/datastore.py')
-rw-r--r-- | src/carquinyol/datastore.py | 22 |
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 |