51
53
if self.buflen > self.buf_limit:
54
57
class TemplatedBranchView(object):
56
59
template_path = None
58
def __init__(self, branch, history):
61
def __init__(self, branch, history_callable):
59
62
self._branch = branch
60
self._history = history
63
self._history_callable = history_callable
61
65
self.log = branch.log
69
if self.__history is not None:
71
self.__history = self._history_callable()
63
74
def __call__(self, environ, start_response):
76
kwargs = dict(parse_querystring(environ))
77
util.set_context(kwargs)
80
arg = path_info_pop(environ)
87
path = '/'.join(args[1:])
91
'static_url': self._branch.static_url,
92
'branch': self._branch,
94
'url': self._branch.context_url,
96
vals.update(templatefunctions)
99
vals.update(self.get_values(path, kwargs, headers))
101
self.log.info('Getting information for %s: %r secs' % (
102
self.__class__.__name__, time.time() - z))
103
if 'Content-Type' not in headers:
104
headers['Content-Type'] = 'text/html'
105
writer = start_response("200 OK", headers.items())
106
template = load_template(self.template_path)
108
w = BufferingWriter(writer, 8192)
109
template.expand_into(w, **vals)
112
'Rendering %s: %r secs, %s bytes, %s (%2.1f%%) bytes saved' % (
113
self.__class__.__name__,
117
100.0*w.bytes_saved/w.bytes))
66
kw = dict(parse_querystring(environ))
73
arg = path_info_pop(environ)
79
'branch': self._branch,
82
'url': self._branch.context_url,
84
vals.update(templatefunctions)
86
vals.update(self.get_values(h, args, kw, headers))
88
self.log.info('Getting information for %s: %r secs' % (
89
self.__class__.__name__, time.time() - z,))
90
if 'Content-Type' not in headers:
91
headers['Content-Type'] = 'text/html'
92
writer = start_response("200 OK", headers.items())
93
template = load_template(self.template_path)
95
w = BufferingWriter(writer, 8192)
96
template.expand_into(w, **vals)
98
self.log.info('Rendering %s: %r secs, %s bytes, %s (%2.1f%%) bytes saved' % (
99
self.__class__.__name__, time.time() - z, w.bytes, w.bytes_saved, 100.0*w.bytes_saved/w.bytes))
124
if len(self.args) > 0:
125
return h.fix_revid(self.args[0])