/loggerhead/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/loggerhead/trunk

« back to all changes in this revision

Viewing changes to loggerhead/templatefunctions.py

  • Committer: Martin Albisetti
  • Date: 2008-10-24 17:54:06 UTC
  • mfrom: (230.1.2 pep8)
  • Revision ID: martin.albisetti@canonical.com-20081024175406-73bpc73m7pshat9c
PEP8 fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
import os
17
17
from loggerhead.zptsupport import zpt
18
18
 
 
19
 
19
20
templatefunctions = {}
 
21
 
 
22
 
20
23
def templatefunc(func):
21
24
    templatefunctions[func.__name__] = func
22
25
    return func
23
26
 
24
27
 
25
28
_base = os.path.dirname(__file__)
 
29
 
 
30
 
26
31
def _pt(name):
27
32
    return zpt(os.path.join(_base, 'templates', name + '.pt'))
28
33
 
30
35
templatefunctions['macros'] = _pt('macros').macros
31
36
templatefunctions['breadcrumbs'] = _pt('breadcrumbs').macros
32
37
 
 
38
 
33
39
@templatefunc
34
40
def file_change_summary(url, entry, modified_file_link):
35
41
    return _pt('revisionfilechanges').expand(
36
42
        url=url, entry=entry, modified_file_link=modified_file_link,
37
43
        **templatefunctions)
38
44
 
 
45
 
39
46
@templatefunc
40
47
def revisioninfo(url, branch, entry, modified_file_link=None):
41
48
    from loggerhead import util
44
51
        modified_file_link=modified_file_link,
45
52
        **templatefunctions)
46
53
 
 
54
 
47
55
@templatefunc
48
56
def collapse_button(group, name, branch, normal='block'):
49
57
    return _pt('collapse-button').expand(
50
58
        group=group, name=name, normal=normal, branch=branch,
51
59
        **templatefunctions)
52
60
 
 
61
 
53
62
@templatefunc
54
63
def collapse_all_button(group, branch, normal='block'):
55
64
    return _pt('collapse-all-button').expand(
56
65
        group=group, normal=normal, branch=branch,
57
66
        **templatefunctions)
58
67
 
 
68
 
59
69
@templatefunc
60
70
def revno_with_nick(entry):
61
71
    if entry.branch_nick:
64
74
        extra = ''
65
75
    return '(%s%s)'%(entry.revno, extra)
66
76
 
 
77
 
67
78
@templatefunc
68
79
def modified_file_link_rev(url, entry, item):
69
80
    return _pt('modified-file-link-rev').expand(
70
81
        url=url, entry=entry, item=item,
71
82
        **templatefunctions)
72
83
 
 
84
 
73
85
@templatefunc
74
86
def modified_file_link_log(url, entry, item):
75
87
    return _pt('modified-file-link-log').expand(
76
88
        url=url, entry=entry, item=item,
77
89
        **templatefunctions)
78
90
 
 
91
 
79
92
@templatefunc
80
93
def search_box(branch, navigation):
81
94
    return _pt('search-box').expand(branch=branch, navigation=navigation,
82
95
        **templatefunctions)
83
96
 
 
97
 
84
98
@templatefunc
85
99
def feed_link(branch, url):
86
100
    return _pt('feed-link').expand(branch=branch, url=url, **templatefunctions)
87
101
 
 
102
 
88
103
@templatefunc
89
104
def menu(branch, url, fileview_active=False):
90
105
    return _pt('menu').expand(branch=branch, url=url,