Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Silbe <sascha-pgp@silbe.org>2010-08-30 22:18:37 (GMT)
committer Sascha Silbe <sascha-pgp@silbe.org>2010-08-30 22:18:37 (GMT)
commit8432e0d748f9070c5bf2bcb640332f1bb2ab0993 (patch)
treed64cc504a73dce9465d0deb570e61d4318ce8413
parent874aa67087df9e9b6cd3c10c19fdcd1ba6ff53b4 (diff)
fix ctime parsing, add workaround for SL#1590
-rw-r--r--restore.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/restore.py b/restore.py
index af970f4..26183a0 100644
--- a/restore.py
+++ b/restore.py
@@ -419,17 +419,22 @@ class AsyncRestore(gobject.GObject):
version_id)
return
- # FIXME: cannot restore version_id
+ # workaround for SL#1590
+ timestamp = metadata.get('timestamp') or \
+ time.mktime(time.strptime(metadata['ctime'], CTIME_FORMAT))
+ metadata['timestamp'] = str(int(float(timestamp)))
self._data_store.save(tree_id, parent_id, metadata, data_path,
True, timeout=DS_DBUS_SAVE_TIMEOUT)
else:
uid = metadata.get('uid') or metadata['tree_id']
timestamp = metadata.get('timestamp') or \
- time.strftime(CTIME_FORMAT, metadata['ctime'])
+ time.mktime(time.strptime(metadata['ctime'], CTIME_FORMAT))
+ timestamp = float(timestamp)
entry = self._find_entry_v1(uid)
if entry:
ds_timestamp = entry.get('timestamp') or \
- time.strftime(CTIME_FORMAT, entry['ctime'])
+ time.mktime(time.strptime(entry['ctime'], CTIME_FORMAT))
+ ds_timestamp = float(ds_timestamp)
if ds_timestamp >= timestamp:
logging.info('Skipping outdated entry for %r', uid)
@@ -439,6 +444,8 @@ class AsyncRestore(gobject.GObject):
else:
logging.info('Restoring entry %r', uid)
+ # workaround for SL#1590
+ metadata['timestamp'] = str(int(timestamp))
self._data_store.update(uid, metadata, data_path, True,
timeout=DS_DBUS_SAVE_TIMEOUT)