/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/__init__.py

tidyings, and efforts to not recompile some of the zpts each time they're used

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
import os
2
2
import turbogears
3
3
import turbozpt
4
 
from turbozpt.template import PageTemplate
 
4
from turbozpt.template import zpt
5
5
 
6
6
_base = os.path.dirname(__file__)
7
7
def _pt(name):
8
 
    return PageTemplate(os.path.join(_base, 'templates', name + '.pt'))
 
8
    return zpt(os.path.join(_base, 'templates', name + '.pt'))
9
9
 
10
10
 
11
11
def file_change_summary(url, entry, links=True):
12
 
    return _pt('revisionfilechanges').render(
13
 
        dict(url=url, entry=entry, links=links))
 
12
    return _pt('revisionfilechanges')(url=url, entry=entry, links=links)
14
13
 
15
14
def revisioninfo(url, branch, entry, includefilechanges=False):
16
15
    from loggerhead import util
17
 
    return _pt('revisioninfo').render(
18
 
        dict(url=url, change=entry, branch=branch, util=util,
19
 
             includefilechanges=includefilechanges,
20
 
             file_change_summary=file_change_summary))
 
16
    return _pt('revisioninfo')(
 
17
        url=url, change=entry, branch=branch, util=util,
 
18
        includefilechanges=includefilechanges,
 
19
        file_change_summary=file_change_summary)
21
20
 
22
21
 
23
22
def collapse_button(group, name, normal='block'):
24
 
    return _pt('collapse-button').render(
25
 
        dict(group=group, name=name, normal=normal, tg=turbogears))
 
23
    return _pt('collapse-button')(
 
24
        group=group, name=name, normal=normal, tg=turbogears)
26
25
 
27
26
def collapse_all_button(group, normal='block'):
28
 
    return _pt('collapse-all-button').render(
29
 
        dict(group=group, normal=normal, tg=turbogears))
 
27
    return _pt('collapse-all-button')(
 
28
        group=group, normal=normal, tg=turbogears)
30
29
 
31
30
templatefunctions = {'file_change_summary':file_change_summary,
32
31
                     'revisioninfo':revisioninfo,