Mercurial > kallithea
comparison rhodecode/controllers/shortlog.py @ 547:1e757ac98988
renamed project to rhodecode
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Wed, 06 Oct 2010 03:18:16 +0200 |
parents | pylons_app/controllers/shortlog.py@fdf9f6ee5217 |
children | 7e536d1af60d |
comparison
equal
deleted
inserted
replaced
546:7c2f5e4d7bbf | 547:1e757ac98988 |
---|---|
1 #!/usr/bin/env python | |
2 # encoding: utf-8 | |
3 # shortlog controller for pylons | |
4 # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> | |
5 | |
6 # This program is free software; you can redistribute it and/or | |
7 # modify it under the terms of the GNU General Public License | |
8 # as published by the Free Software Foundation; version 2 | |
9 # of the License or (at your opinion) any later version of the license. | |
10 # | |
11 # This program is distributed in the hope that it will be useful, | |
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 # GNU General Public License for more details. | |
15 # | |
16 # You should have received a copy of the GNU General Public License | |
17 # along with this program; if not, write to the Free Software | |
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
19 # MA 02110-1301, USA. | |
20 """ | |
21 Created on April 18, 2010 | |
22 shortlog controller for pylons | |
23 @author: marcink | |
24 """ | |
25 from pylons import tmpl_context as c, request | |
26 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator | |
27 from rhodecode.lib.base import BaseController, render | |
28 from rhodecode.model.hg_model import HgModel | |
29 from webhelpers.paginate import Page | |
30 import logging | |
31 log = logging.getLogger(__name__) | |
32 | |
33 class ShortlogController(BaseController): | |
34 | |
35 @LoginRequired() | |
36 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', | |
37 'repository.admin') | |
38 def __before__(self): | |
39 super(ShortlogController, self).__before__() | |
40 | |
41 def index(self): | |
42 p = int(request.params.get('page', 1)) | |
43 repo = HgModel().get_repo(c.repo_name) | |
44 c.repo_changesets = Page(repo, page=p, items_per_page=20) | |
45 c.shortlog_data = render('shortlog/shortlog_data.html') | |
46 if request.params.get('partial'): | |
47 return c.shortlog_data | |
48 r = render('shortlog/shortlog.html') | |
49 return r |