Mercurial > kallithea
annotate pylons_app/lib/filters.py @ 111:70b1e5d1e20d
simplehg, cleanup
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Wed, 28 Apr 2010 00:16:08 +0200 |
parents | 9f6300b96380 |
children | 3782a6d698af |
rev | line source |
---|---|
74
cdf4fda66dd9
Started summary page. Added filters to templates. used by n,self.f.filtername prefixed by n to disable other filters. Few other fixes found
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
1 from mercurial import util |
83
db39d0ca5308
implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
80
diff
changeset
|
2 from mercurial.templatefilters import age as _age, person as _person |
87
9f6300b96380
Updated error handling, from mercurial to pylons. + added tempalte for 404
Marcin Kuzminski <marcin@python-blog.com>
parents:
83
diff
changeset
|
3 from string import punctuation |
9f6300b96380
Updated error handling, from mercurial to pylons. + added tempalte for 404
Marcin Kuzminski <marcin@python-blog.com>
parents:
83
diff
changeset
|
4 |
9f6300b96380
Updated error handling, from mercurial to pylons. + added tempalte for 404
Marcin Kuzminski <marcin@python-blog.com>
parents:
83
diff
changeset
|
5 def clean_repo(repo_name): |
9f6300b96380
Updated error handling, from mercurial to pylons. + added tempalte for 404
Marcin Kuzminski <marcin@python-blog.com>
parents:
83
diff
changeset
|
6 for x in punctuation: |
9f6300b96380
Updated error handling, from mercurial to pylons. + added tempalte for 404
Marcin Kuzminski <marcin@python-blog.com>
parents:
83
diff
changeset
|
7 if x != '_': |
9f6300b96380
Updated error handling, from mercurial to pylons. + added tempalte for 404
Marcin Kuzminski <marcin@python-blog.com>
parents:
83
diff
changeset
|
8 repo_name = repo_name.replace(x, '') |
9f6300b96380
Updated error handling, from mercurial to pylons. + added tempalte for 404
Marcin Kuzminski <marcin@python-blog.com>
parents:
83
diff
changeset
|
9 repo_name = repo_name.lower().strip() |
9f6300b96380
Updated error handling, from mercurial to pylons. + added tempalte for 404
Marcin Kuzminski <marcin@python-blog.com>
parents:
83
diff
changeset
|
10 return repo_name.replace(' ', '_') |
74
cdf4fda66dd9
Started summary page. Added filters to templates. used by n,self.f.filtername prefixed by n to disable other filters. Few other fixes found
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
11 |
83
db39d0ca5308
implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
80
diff
changeset
|
12 age = lambda x:_age(x) |
74
cdf4fda66dd9
Started summary page. Added filters to templates. used by n,self.f.filtername prefixed by n to disable other filters. Few other fixes found
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
13 capitalize = lambda x: x.capitalize() |
cdf4fda66dd9
Started summary page. Added filters to templates. used by n,self.f.filtername prefixed by n to disable other filters. Few other fixes found
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
14 date = lambda x: util.datestr(x) |
cdf4fda66dd9
Started summary page. Added filters to templates. used by n,self.f.filtername prefixed by n to disable other filters. Few other fixes found
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
15 email = util.email |
83
db39d0ca5308
implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
80
diff
changeset
|
16 person = lambda x: _person(x) |
db39d0ca5308
implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
80
diff
changeset
|
17 hgdate = lambda x: "%d %d" % x |
db39d0ca5308
implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
80
diff
changeset
|
18 isodate = lambda x: util.datestr(x, '%Y-%m-%d %H:%M %1%2') |
db39d0ca5308
implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
80
diff
changeset
|
19 isodatesec = lambda x: util.datestr(x, '%Y-%m-%d %H:%M:%S %1%2') |
db39d0ca5308
implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
80
diff
changeset
|
20 localdate = lambda x: (x[0], util.makedate()[1]) |
db39d0ca5308
implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
80
diff
changeset
|
21 rfc822date = lambda x: util.datestr(x, "%a, %d %b %Y %H:%M:%S %1%2") |
db39d0ca5308
implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
80
diff
changeset
|
22 rfc3339date = lambda x: util.datestr(x, "%Y-%m-%dT%H:%M:%S%1:%2") |
db39d0ca5308
implemented Shortlog as seperate controller,
Marcin Kuzminski <marcin@python-blog.com>
parents:
80
diff
changeset
|
23 time_ago = lambda x: util.datestr(_age(x), "%a, %d %b %Y %H:%M:%S %1%2") |