bzr branch
http://gegoxaren.bato24.eu/bzr/loggerhead/trunk
|
183.2.1
by John Arbash Meinel
Add Copyright information to most files. |
1 |
#
|
2 |
# This program is free software; you can redistribute it and/or modify
|
|
3 |
# it under the terms of the GNU General Public License as published by
|
|
4 |
# the Free Software Foundation; either version 2 of the License, or
|
|
5 |
# (at your option) any later version.
|
|
6 |
#
|
|
7 |
# This program is distributed in the hope that it will be useful,
|
|
8 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
9 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
10 |
# GNU General Public License for more details.
|
|
11 |
#
|
|
12 |
# You should have received a copy of the GNU General Public License
|
|
13 |
# along with this program; if not, write to the Free Software
|
|
14 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
15 |
#
|
|
|
128.6.36
by Michael Hudson
move the templatefunctions to a better location |
16 |
import os |
|
159.2.30
by Michael Hudson
trim down turbosimpletal and move it inside loggerhead package. |
17 |
from loggerhead.zptsupport import zpt |
|
128.6.36
by Michael Hudson
move the templatefunctions to a better location |
18 |
|
19 |
templatefunctions = {} |
|
20 |
def templatefunc(func): |
|
21 |
templatefunctions[func.__name__] = func |
|
22 |
return func |
|
23 |
||
|
128.6.37
by Michael Hudson
convert annotate.pt to using metal in preparation for getting rid of the bizarro "here" hack |
24 |
|
25 |
_base = os.path.dirname(__file__) |
|
26 |
def _pt(name): |
|
27 |
return zpt(os.path.join(_base, 'templates', name + '.pt')) |
|
28 |
||
29 |
||
|
128.6.38
by Michael Hudson
browse.pt -> metal and some fixes |
30 |
templatefunctions['macros'] = _pt('macros').macros |
|
128.6.37
by Michael Hudson
convert annotate.pt to using metal in preparation for getting rid of the bizarro "here" hack |
31 |
|
|
128.6.36
by Michael Hudson
move the templatefunctions to a better location |
32 |
@templatefunc
|
33 |
def file_change_summary(url, entry, modified_file_link): |
|
|
128.6.59
by Michael Hudson
mostly more unicode fixes |
34 |
return _pt('revisionfilechanges').expand( |
|
128.6.36
by Michael Hudson
move the templatefunctions to a better location |
35 |
url=url, entry=entry, modified_file_link=modified_file_link, |
36 |
**templatefunctions) |
|
37 |
||
38 |
@templatefunc
|
|
|
128.8.7
by Martin Albisetti
* Removed passing revid to revision info and using change instead |
39 |
def revisioninfo(url, branch, entry, modified_file_link=None): |
|
128.6.36
by Michael Hudson
move the templatefunctions to a better location |
40 |
from loggerhead import util |
|
128.6.59
by Michael Hudson
mostly more unicode fixes |
41 |
return _pt('revisioninfo').expand( |
|
128.6.36
by Michael Hudson
move the templatefunctions to a better location |
42 |
url=url, change=entry, branch=branch, util=util, |
|
128.8.7
by Martin Albisetti
* Removed passing revid to revision info and using change instead |
43 |
modified_file_link=modified_file_link, |
|
128.6.36
by Michael Hudson
move the templatefunctions to a better location |
44 |
**templatefunctions) |
45 |
||
46 |
@templatefunc
|
|
|
159.2.11
by Michael Hudson
hacking towards server from urls based on file paths. |
47 |
def collapse_button(group, name, branch, normal='block'): |
|
128.6.59
by Michael Hudson
mostly more unicode fixes |
48 |
return _pt('collapse-button').expand( |
|
159.2.11
by Michael Hudson
hacking towards server from urls based on file paths. |
49 |
group=group, name=name, normal=normal, branch=branch, |
|
128.6.36
by Michael Hudson
move the templatefunctions to a better location |
50 |
**templatefunctions) |
51 |
||
52 |
@templatefunc
|
|
|
159.2.11
by Michael Hudson
hacking towards server from urls based on file paths. |
53 |
def collapse_all_button(group, branch, normal='block'): |
|
128.6.59
by Michael Hudson
mostly more unicode fixes |
54 |
return _pt('collapse-all-button').expand( |
|
159.2.11
by Michael Hudson
hacking towards server from urls based on file paths. |
55 |
group=group, normal=normal, branch=branch, |
|
128.6.36
by Michael Hudson
move the templatefunctions to a better location |
56 |
**templatefunctions) |
57 |
||
58 |
@templatefunc
|
|
59 |
def revno_with_nick(entry): |
|
60 |
if entry.branch_nick: |
|
61 |
extra = ' ' + entry.branch_nick |
|
62 |
else: |
|
63 |
extra = '' |
|
64 |
return '(%s%s)'%(entry.revno, extra) |
|
65 |
||
66 |
@templatefunc
|
|
67 |
def modified_file_link_rev(url, entry, item): |
|
|
128.6.59
by Michael Hudson
mostly more unicode fixes |
68 |
return _pt('modified-file-link-rev').expand( |
|
128.6.36
by Michael Hudson
move the templatefunctions to a better location |
69 |
url=url, entry=entry, item=item, |
70 |
**templatefunctions) |
|
71 |
||
72 |
@templatefunc
|
|
73 |
def modified_file_link_log(url, entry, item): |
|
|
128.6.59
by Michael Hudson
mostly more unicode fixes |
74 |
return _pt('modified-file-link-log').expand( |
|
128.6.36
by Michael Hudson
move the templatefunctions to a better location |
75 |
url=url, entry=entry, item=item, |
76 |
**templatefunctions) |
|
|
207.1.1
by Paul Hummer
Added search_box |
77 |
|
78 |
@templatefunc
|
|
79 |
def search_box(): |
|
80 |
return _pt('search-box').expand(**templatefunctions) |
|
81 |
||
|
207.1.3
by Paul Hummer
Added feed_link template function |
82 |
@templatefunc
|
83 |
def feed_link(branch): |
|
84 |
return _pt('feed-link').expand(branch=branch, **templatefunctions) |
|
|
207.1.4
by Paul Hummer
Pulled menu into its own template |
85 |
|
86 |
@templatefunc
|
|
|
207.2.1
by Martin Albisetti
Pass on url to the menu template |
87 |
def menu(branch, url): |
88 |
return _pt('menu').expand(branch=branch, url=url, **templatefunctions) |