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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
import os
import turbogears
from turbosimpletal.zptsupport import zpt
templatefunctions = {}
def templatefunc(func):
templatefunctions[func.__name__] = func
return func
_base = os.path.dirname(__file__)
def _pt(name):
return zpt(os.path.join(_base, 'templates', name + '.pt'))
templatefunctions['macros'] = _pt('macros').macros
@templatefunc
def file_change_summary(url, entry, modified_file_link):
return _pt('revisionfilechanges').expand(
url=url, entry=entry, modified_file_link=modified_file_link,
**templatefunctions)
@templatefunc
def revisioninfo(url, branch, entry, modified_file_link=None):
from loggerhead import util
return _pt('revisioninfo').expand(
url=url, change=entry, branch=branch, util=util,
modified_file_link=modified_file_link,
**templatefunctions)
@templatefunc
def collapse_button(group, name, normal='block'):
return _pt('collapse-button').expand(
group=group, name=name, normal=normal, tg=turbogears,
**templatefunctions)
@templatefunc
def collapse_all_button(group, normal='block'):
return _pt('collapse-all-button').expand(
group=group, normal=normal, tg=turbogears,
**templatefunctions)
@templatefunc
def revno_with_nick(entry):
if entry.branch_nick:
extra = ' ' + entry.branch_nick
else:
extra = ''
return '(%s%s)'%(entry.revno, extra)
@templatefunc
def modified_file_link_rev(url, entry, item):
return _pt('modified-file-link-rev').expand(
url=url, entry=entry, item=item,
**templatefunctions)
@templatefunc
def modified_file_link_log(url, entry, item):
return _pt('modified-file-link-log').expand(
url=url, entry=entry, item=item,
**templatefunctions)
|