Mercurial > hg-stable
changeset 10601:b98b6a7363ae
templatefilters: store the agescales in reverseorder directly
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Sat, 06 Mar 2010 13:29:54 +0100 |
parents | 033d2fdc3b9d |
children | 94145b531cf9 |
files | mercurial/templatefilters.py |
diffstat | 1 files changed, 6 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/templatefilters.py Sat Mar 06 12:45:14 2010 +0100 +++ b/mercurial/templatefilters.py Sat Mar 06 13:29:54 2010 +0100 @@ -14,15 +14,13 @@ return "".join([stringify(t) for t in thing if t is not None]) return str(thing) -agescales = [("second", 1), - ("minute", 60), - ("hour", 3600), - ("day", 3600 * 24), +agescales = [("year", 3600 * 24 * 365), + ("month", 3600 * 24 * 30), ("week", 3600 * 24 * 7), - ("month", 3600 * 24 * 30), - ("year", 3600 * 24 * 365)] - -agescales.reverse() + ("day", 3600 * 24), + ("hour", 3600), + ("minute", 60), + ("second", 1),] def age(date): '''turn a (timestamp, tzoff) tuple into an age string.'''