Mercurial > kallithea
comparison kallithea/controllers/bookmarks.py @ 4187:d1addaf7a91e kallithea-2.2.5-rebrand
Second step in two-part process to rename directories.
This is the actual directory rename.
author | Bradley M. Kuhn <bkuhn@sfconservancy.org> |
---|---|
date | Wed, 02 Jul 2014 19:04:33 -0400 |
parents | rhodecode/controllers/bookmarks.py@7e5f8c12a3fc |
children | 06e49be38d78 |
comparison
equal
deleted
inserted
replaced
4186:7e5f8c12a3fc | 4187:d1addaf7a91e |
---|---|
1 # -*- coding: utf-8 -*- | |
2 # This program is free software: you can redistribute it and/or modify | |
3 # it under the terms of the GNU General Public License as published by | |
4 # the Free Software Foundation, either version 3 of the License, or | |
5 # (at your option) any later version. | |
6 # | |
7 # This program is distributed in the hope that it will be useful, | |
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
10 # GNU General Public License for more details. | |
11 # | |
12 # You should have received a copy of the GNU General Public License | |
13 # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
14 """ | |
15 kallithea.controllers.bookmarks | |
16 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
17 | |
18 Bookmarks controller for rhodecode | |
19 | |
20 :created_on: Dec 1, 2011 | |
21 :author: marcink | |
22 :copyright: (c) 2013 RhodeCode GmbH. | |
23 :license: GPLv3, see LICENSE for more details. | |
24 """ | |
25 | |
26 import logging | |
27 | |
28 from pylons import tmpl_context as c | |
29 | |
30 from kallithea.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator | |
31 from kallithea.lib.base import BaseRepoController, render | |
32 from kallithea.lib.compat import OrderedDict | |
33 from webob.exc import HTTPNotFound | |
34 | |
35 log = logging.getLogger(__name__) | |
36 | |
37 | |
38 class BookmarksController(BaseRepoController): | |
39 | |
40 def __before__(self): | |
41 super(BookmarksController, self).__before__() | |
42 | |
43 @LoginRequired() | |
44 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', | |
45 'repository.admin') | |
46 def index(self): | |
47 if c.rhodecode_repo.alias != 'hg': | |
48 raise HTTPNotFound() | |
49 | |
50 c.repo_bookmarks = OrderedDict() | |
51 | |
52 bookmarks = [(name, c.rhodecode_repo.get_changeset(hash_)) for \ | |
53 name, hash_ in c.rhodecode_repo._repo._bookmarks.items()] | |
54 ordered_tags = sorted(bookmarks, key=lambda x: x[1].date, reverse=True) | |
55 for name, cs_book in ordered_tags: | |
56 c.repo_bookmarks[name] = cs_book | |
57 | |
58 return render('bookmarks/bookmarks.html') |