Mercurial > kallithea
annotate rhodecode/controllers/bookmarks.py @ 4116:ffd45b185016 rhodecode-2.2.5-gpl
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
This imports changes between changesets 21af6c4eab3d and 6177597791c2 in
RhodeCode's original repository, including only changes to Python files and HTML.
RhodeCode clearly licensed its changes to these files under GPLv3
in their /LICENSE file, which states the following:
The Python code and integrated HTML are licensed under the GPLv3 license.
(See:
https://code.rhodecode.com/rhodecode/files/v2.2.5/LICENSE
or
http://web.archive.org/web/20140512193334/https://code.rhodecode.com/rhodecode/files/f3b123159901f15426d18e3dc395e8369f70ebe0/LICENSE
for an online copy of that LICENSE file)
Conservancy reviewed these changes and confirmed that they can be licensed as
a whole to the Kallithea project under GPLv3-only.
While some of the contents committed herein are clearly licensed
GPLv3-or-later, on the whole we must assume the are GPLv3-only, since the
statement above from RhodeCode indicates that they intend GPLv3-only as their
license, per GPLv3ยง14 and other relevant sections of GPLv3.
author | Bradley M. Kuhn <bkuhn@sfconservancy.org> |
---|---|
date | Wed, 02 Jul 2014 19:03:13 -0400 |
parents | b950b884ab87 |
children | 7e5f8c12a3fc |
rev | line source |
---|---|
1748
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
1 # -*- coding: utf-8 -*- |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
2 # This program is free software: you can redistribute it and/or modify |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
3 # it under the terms of the GNU General Public License as published by |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
4 # the Free Software Foundation, either version 3 of the License, or |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
5 # (at your option) any later version. |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
6 # |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
7 # This program is distributed in the hope that it will be useful, |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
10 # GNU General Public License for more details. |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
11 # |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
12 # You should have received a copy of the GNU General Public License |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
13 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3749
diff
changeset
|
14 """ |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3749
diff
changeset
|
15 rhodecode.controllers.bookmarks |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3749
diff
changeset
|
16 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3749
diff
changeset
|
17 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3749
diff
changeset
|
18 Bookmarks controller for rhodecode |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3749
diff
changeset
|
19 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3749
diff
changeset
|
20 :created_on: Dec 1, 2011 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3749
diff
changeset
|
21 :author: marcink |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3749
diff
changeset
|
22 :copyright: (c) 2013 RhodeCode GmbH. |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3749
diff
changeset
|
23 :license: GPLv3, see LICENSE for more details. |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3749
diff
changeset
|
24 """ |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
3749
diff
changeset
|
25 |
1748
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
26 import logging |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
27 |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
28 from pylons import tmpl_context as c |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
29 |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
30 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
31 from rhodecode.lib.base import BaseRepoController, render |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
32 from rhodecode.lib.compat import OrderedDict |
1754
d0effbe1acb1
banned git-repos to use bookmarks views
Marcin Kuzminski <marcin@python-works.com>
parents:
1748
diff
changeset
|
33 from webob.exc import HTTPNotFound |
1748
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
34 |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
35 log = logging.getLogger(__name__) |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
36 |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
37 |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
38 class BookmarksController(BaseRepoController): |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
39 |
3749
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
1824
diff
changeset
|
40 def __before__(self): |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
1824
diff
changeset
|
41 super(BookmarksController, self).__before__() |
b950b884ab87
auth decorators are not used anymore on __before__
Marcin Kuzminski <marcin@python-works.com>
parents:
1824
diff
changeset
|
42 |
1748
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
43 @LoginRequired() |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
44 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
45 'repository.admin') |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
46 def index(self): |
1754
d0effbe1acb1
banned git-repos to use bookmarks views
Marcin Kuzminski <marcin@python-works.com>
parents:
1748
diff
changeset
|
47 if c.rhodecode_repo.alias != 'hg': |
d0effbe1acb1
banned git-repos to use bookmarks views
Marcin Kuzminski <marcin@python-works.com>
parents:
1748
diff
changeset
|
48 raise HTTPNotFound() |
1818
cf51bbfb120e
auto white-space removal
Marcin Kuzminski <marcin@python-works.com>
parents:
1754
diff
changeset
|
49 |
1748
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
50 c.repo_bookmarks = OrderedDict() |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
51 |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
52 bookmarks = [(name, c.rhodecode_repo.get_changeset(hash_)) for \ |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
53 name, hash_ in c.rhodecode_repo._repo._bookmarks.items()] |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
54 ordered_tags = sorted(bookmarks, key=lambda x: x[1].date, reverse=True) |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
55 for name, cs_book in ordered_tags: |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
56 c.repo_bookmarks[name] = cs_book |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
57 |
a3ee2611e6e8
implements #135 bookmark support for UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
58 return render('bookmarks/bookmarks.html') |