Show More
@@ -1,31 +1,29 b'' | |||
|
1 | 1 | #!/usr/bin/python |
|
2 | 2 | # -*- coding: utf-8 -*- |
|
3 | 3 | import logging |
|
4 | 4 | from operator import itemgetter |
|
5 | 5 | from pylons import tmpl_context as c, request, config |
|
6 | 6 | from pylons_app.lib.base import BaseController, render |
|
7 | from pylons_app.lib.utils import get_repo_slug | |
|
8 | from pylons_app.model.hg_model import HgModel | |
|
9 | 7 | from pylons_app.lib.auth import LoginRequired |
|
10 | 8 | log = logging.getLogger(__name__) |
|
11 | 9 | |
|
12 | 10 | class HgController(BaseController): |
|
13 | 11 | |
|
14 | 12 | @LoginRequired() |
|
15 | 13 | def __before__(self): |
|
16 | 14 | super(HgController, self).__before__() |
|
17 | 15 | |
|
18 | 16 | def index(self): |
|
19 | 17 | c.current_sort = request.GET.get('sort', 'name') |
|
20 | 18 | cs = c.current_sort |
|
21 | 19 | c.cs_slug = cs.replace('-', '') |
|
22 | 20 | sortables = ['name', 'description', 'last_change', 'tip', 'contact'] |
|
23 | 21 | |
|
24 | 22 | if cs and c.cs_slug in sortables: |
|
25 | 23 | sort_key = c.cs_slug + '_sort' |
|
26 | 24 | if cs.startswith('-'): |
|
27 | 25 | c.repos_list = sorted(c.cached_repo_list, key=itemgetter(sort_key), reverse=True) |
|
28 | 26 | else: |
|
29 | 27 | c.repos_list = sorted(c.cached_repo_list, key=itemgetter(sort_key), reverse=False) |
|
30 | 28 | |
|
31 | 29 | return render('/index.html') |
General Comments 0
You need to be logged in to leave comments.
Login now