comparison rhodecode/controllers/branches.py @ 861:fd2ea6ceadc8 beta

updated docs on every controller
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 18 Dec 2010 16:55:28 +0100
parents 7486da5f0628
children 07a6e8c65526 a3b2b4b4e440
comparison
equal deleted inserted replaced
860:5f7731e3ab4d 861:fd2ea6ceadc8
1 #!/usr/bin/env python 1 # -*- coding: utf-8 -*-
2 # encoding: utf-8 2 """
3 # branches controller for pylons 3 rhodecode.controllers.branches
4 # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> 4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 # 5
6 branches controller for rhodecode
7
8 :created_on: Apr 21, 2010
9 :author: marcink
10 :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
11 :license: GPLv3, see COPYING for more details.
12 """
6 # This program is free software; you can redistribute it and/or 13 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License 14 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; version 2 15 # as published by the Free Software Foundation; version 2
9 # of the License or (at your opinion) any later version of the license. 16 # of the License or (at your opinion) any later version of the license.
10 # 17 #
15 # 22 #
16 # You should have received a copy of the GNU General Public License 23 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software 24 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 25 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 # MA 02110-1301, USA. 26 # MA 02110-1301, USA.
20 """ 27
21 Created on April 21, 2010 28 import logging
22 branches controller for pylons 29
23 @author: marcink
24 """
25 from pylons import tmpl_context as c 30 from pylons import tmpl_context as c
31
26 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator 32 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
27 from rhodecode.lib.base import BaseController, render 33 from rhodecode.lib.base import BaseController, render
28 from rhodecode.lib.utils import OrderedDict 34 from rhodecode.lib.utils import OrderedDict
29 from rhodecode.model.scm import ScmModel 35 from rhodecode.model.scm import ScmModel
30 import logging 36
31 log = logging.getLogger(__name__) 37 log = logging.getLogger(__name__)
32 38
33 class BranchesController(BaseController): 39 class BranchesController(BaseController):
34 40
35 @LoginRequired() 41 @LoginRequired()
36 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', 'repository.admin') 42 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
43 'repository.admin')
37 def __before__(self): 44 def __before__(self):
38 super(BranchesController, self).__before__() 45 super(BranchesController, self).__before__()
39 46
40 def index(self): 47 def index(self):
41 hg_model = ScmModel() 48 hg_model = ScmModel()
42 c.repo_info = hg_model.get_repo(c.repo_name) 49 c.repo_info = hg_model.get_repo(c.repo_name)
43 c.repo_branches = OrderedDict() 50 c.repo_branches = OrderedDict()
44 for name, hash_ in c.repo_info.branches.items(): 51 for name, hash_ in c.repo_info.branches.items():
45 c.repo_branches[name] = c.repo_info.get_changeset(hash_) 52 c.repo_branches[name] = c.repo_info.get_changeset(hash_)
46 53
47 return render('branches/branches.html') 54 return render('branches/branches.html')