Mercurial > public > src > rhodecode
diff pylons_app/lib/helpers.py @ 289:237470e64bb8
switched filters into webhelpers for easy of usage.
Rewrite of html to use predefined templates from branches shortlog tags, for DRY usage.
Added info messages about empty branches/tags etc.
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sun, 13 Jun 2010 23:56:16 +0200 |
parents | cd2ee462fc2c |
children | c4caeca9dd66 |
line wrap: on
line diff
--- a/pylons_app/lib/helpers.py Sun Jun 13 23:14:04 2010 +0200 +++ b/pylons_app/lib/helpers.py Sun Jun 13 23:56:16 2010 +0200 @@ -203,3 +203,29 @@ return slug flash = _Flash() + + +#=============================================================================== +# MERCURIAL FILTERS available via h. +#=============================================================================== + + +from mercurial import util +from mercurial.templatefilters import age as _age, person as _person + +age = lambda x:_age(x) +capitalize = lambda x: x.capitalize() +date = lambda x: util.datestr(x) +email = util.email +person = lambda x: _person(x) +hgdate = lambda x: "%d %d" % x +isodate = lambda x: util.datestr(x, '%Y-%m-%d %H:%M %1%2') +isodatesec = lambda x: util.datestr(x, '%Y-%m-%d %H:%M:%S %1%2') +localdate = lambda x: (x[0], util.makedate()[1]) +rfc822date = lambda x: util.datestr(x, "%a, %d %b %Y %H:%M:%S %1%2") +rfc3339date = lambda x: util.datestr(x, "%Y-%m-%dT%H:%M:%S%1:%2") +time_ago = lambda x: util.datestr(_age(x), "%a, %d %b %Y %H:%M:%S %1%2") + + + +