diff options
author | Aleksey Lim <alsroot@sugarlabs.org> | 2012-10-13 19:56:46 (GMT) |
---|---|---|
committer | Aleksey Lim <alsroot@sugarlabs.org> | 2012-10-13 19:56:46 (GMT) |
commit | ef452ec3d9dd38d32a12c64f8d6fdd7af5038dd3 (patch) | |
tree | 8bef39ed5a2097b70d43ed415cab02c56be454e6 | |
parent | 9108cb5aba91ae30dd5ad5534ec6407ebc54f7df (diff) |
Set index mtime manually
-rw-r--r-- | active_document/directory.py | 5 | ||||
-rw-r--r-- | active_document/index.py | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/active_document/directory.py b/active_document/directory.py index 8af5aa4..ee1db3d 100644 --- a/active_document/directory.py +++ b/active_document/directory.py @@ -78,6 +78,11 @@ class Directory(object): def mtime(self): return self._index.mtime + @mtime.setter + def mtime(self, value): + self._index.mtime = value + self._notify({'event': 'populate', 'props': {'mtime': value}}) + def close(self): """Flush index write pending queue and close the index.""" self._index.close() diff --git a/active_document/index.py b/active_document/index.py index 67ed083..00b69b8 100644 --- a/active_document/index.py +++ b/active_document/index.py @@ -60,6 +60,12 @@ class IndexReader(object): else: return 0 + @mtime.setter + def mtime(self, value): + with file(self._mtime_path, 'w'): + pass + os.utime(self._mtime_path, (value, value)) + def get_cached(self, guid): """Return cached document. |