Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@sugarlabs.org>2009-01-07 17:04:30 (GMT)
committer Tomeu Vizoso <tomeu@sugarlabs.org>2009-01-07 17:04:30 (GMT)
commit964166edd86aca5665d6db2f46c76d41cbd60e1f (patch)
tree1b9008b608505d83a25f357367962cc9337c51ae /src
parent35a8af64f32d057b5cadd83e8a95c84565c23d4b (diff)
Cache mtime for faster sorting
Diffstat (limited to 'src')
-rw-r--r--src/jarabe/journal/model.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/jarabe/journal/model.py b/src/jarabe/journal/model.py
index 147952d..d9e4cf1 100644
--- a/src/jarabe/journal/model.py
+++ b/src/jarabe/journal/model.py
@@ -232,7 +232,7 @@ class InplaceResultSet(BaseResultSet):
if S_IFMT(stat.st_mode) == S_IFDIR:
files.extend(self._get_all_files(full_path))
elif S_IFMT(stat.st_mode) == S_IFREG:
- files.append((full_path, stat))
+ files.append((full_path, stat, int(stat.st_mtime)))
return files
@@ -241,7 +241,7 @@ class InplaceResultSet(BaseResultSet):
if self._file_list is None:
files = self._get_all_files(mount_point)
- files.sort(lambda a, b: int(b[1].st_mtime - a[1].st_mtime))
+ files.sort(lambda a, b: b[2] - a[2])
self._file_list = files
offset = int(query.get('offset', 0))
@@ -251,7 +251,7 @@ class InplaceResultSet(BaseResultSet):
files = self._file_list[offset:offset + limit]
result = []
- for file_path, stat in files:
+ for file_path, stat, mtime_ in files:
metadata = _get_file_metadata(file_path, stat)
result.append(metadata)