Show More
@@ -2,7 +2,7 b'' | |||||
2 | # encoding: utf-8 |
|
2 | # encoding: utf-8 | |
3 | # hg controller for pylons |
|
3 | # hg controller for pylons | |
4 | # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> |
|
4 | # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> | |
5 |
|
5 | # | ||
6 | # This program is free software; you can redistribute it and/or |
|
6 | # This program is free software; you can redistribute it and/or | |
7 | # modify it under the terms of the GNU General Public License |
|
7 | # modify it under the terms of the GNU General Public License | |
8 | # as published by the Free Software Foundation; version 2 |
|
8 | # as published by the Free Software Foundation; version 2 | |
@@ -38,19 +38,20 b' class HgController(BaseController):' | |||||
38 |
|
38 | |||
39 | def index(self): |
|
39 | def index(self): | |
40 | c.current_sort = request.GET.get('sort', 'name') |
|
40 | c.current_sort = request.GET.get('sort', 'name') | |
41 |
|
|
41 | sort_by = c.current_sort | |
42 | sortables = ['name', 'description', 'last_change', 'tip', 'contact'] |
|
42 | sortables = ['name', 'description', 'last_change', 'tip', 'contact'] | |
43 |
|
43 | |||
44 | if cs not in sortables: |
|
44 | c.cs_slug = sort_by.replace('-', '') | |
45 | cs = 'name' |
|
45 | ||
46 | c.cs_slug = cs.replace('-', '') |
|
46 | if c.cs_slug not in sortables: | |
|
47 | sort_by = 'name' | |||
47 |
|
48 | |||
48 | cached_repo_list = HgModel().get_repos() |
|
49 | cached_repo_list = HgModel().get_repos() | |
49 | if cs and c.cs_slug in sortables: |
|
50 | ||
50 |
|
|
51 | sort_key = c.cs_slug + '_sort' | |
51 |
|
|
52 | if sort_by.startswith('-'): | |
52 |
|
|
53 | c.repos_list = sorted(cached_repo_list, key=itemgetter(sort_key), reverse=True) | |
53 |
|
|
54 | else: | |
54 |
|
|
55 | c.repos_list = sorted(cached_repo_list, key=itemgetter(sort_key), reverse=False) | |
55 |
|
56 | |||
56 | return render('/index.html') |
|
57 | return render('/index.html') |
General Comments 0
You need to be logged in to leave comments.
Login now