Parent: [ec7d70] (diff)

Child: [ec4961] (diff)

Download this file

controllers.py    41 lines (29 with data), 1.2 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from tg import expose, url, override_template
from tg.decorators import with_trailing_slash, without_trailing_slash
from pylons import c
from pyforge.controllers import repository
from pyforge.lib.security import require, has_artifact_access
from pyforge.lib import patience
from .widgets import GitRevisionWidget
revision_widget = GitRevisionWidget()
def on_import():
BranchBrowser.CommitBrowserClass = CommitBrowser
class BranchBrowser(repository.BranchBrowser):
def _check_security(self):
require(has_artifact_access('read', c.app.repo))
@expose('forgegit.templates.index')
@with_trailing_slash
def index(self, offset=0, limit=10, **kw):
c.revision_widget=revision_widget
return dict(super(BranchBrowser, self).index(offset, limit),
allow_fork=True)
@expose()
def _lookup(self, rev, *remainder):
return CommitBrowser(rev), remainder
class CommitBrowser(repository.CommitBrowser):
revision_widget = GitRevisionWidget()
@expose('forgegit.templates.commit')
@with_trailing_slash
def index(self):
return super(CommitBrowser, self).index()
on_import()