~ubuntuone-pqm-team/python-plop/trunk

« back to all changes in this revision

Viewing changes to plop/viewer.py

  • Committer: Ben Darnell
  • Date: 2012-03-09 00:44:11 UTC
  • Revision ID: git-v1:84496e449c7dfd6708525881e391fc0f6a6a629e
Better sorting in index

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
        for filename in os.listdir(options.datadir):
22
22
            mtime = os.stat(os.path.join(options.datadir, filename)).st_mtime
23
23
            files.append((mtime, filename))
24
 
        files.sort()
 
24
        # sort by descending mtime then ascending filename
 
25
        files.sort(key=lambda x: (-x[0], x[1]))
25
26
        self.render('index.html', files=[f[1] for f in files])
26
27
 
27
28
class ViewHandler(RequestHandler):