# # # patch "index.psp" # from [4c4e48057137b7128ae152fd020212363d2c7b56] # to [52300f8d9c5048210dadadb1d53de2442ea60ea9] # # patch "template.py" # from [58338ce2547a9bc13e33f7ce670331c8cf9e91e5] # to [918ee71ec6f5ccb116ed425671dd1cad616c9079] # # patch "wrapper.py" # from [3b1dd4c69017b12d2fbbc2ffc421dd3735424c94] # to [f7cb39709eb28cd4a813ef00e8f2e5ac2086dfa0] # ============================================================ --- index.psp 4c4e48057137b7128ae152fd020212363d2c7b56 +++ index.psp 52300f8d9c5048210dadadb1d53de2442ea60ea9 @@ -1,16 +1,14 @@ <% import config import monotone import common import urllib -import template -from template import header,footer from common import link psp.set_error_page("error.psp") info = { 'title' : "Branches" } -req.write(header(info)) +req.write(template.header(info)) hq = common.html_escape() branches = mt.branches() ============================================================ --- template.py 58338ce2547a9bc13e33f7ce670331c8cf9e91e5 +++ template.py 918ee71ec6f5ccb116ed425671dd1cad616c9079 @@ -1,28 +1,29 @@ import time +from viewmtn import release -def header(info): - if not info.has_key("title"): info['title'] = "untitled" - return """\ - - - - -ViewMTN: %(title)s - - - - +class Template: + def header(self, info): + if not info.has_key("title"): info['title'] = "untitled" + return """\ + + + + + ViewMTN: %(title)s + + + + -

%(title)s

-""" % (info) +

%(title)s

+ """ % (info) + def footer(self, info): + return """\ + + """ % (time.strftime("%a, %d %b %Y %H:%M:%S %Z", time.localtime())) -def footer(info): - return """\ - - -""" % (time.strftime("%a, %d %b %Y %H:%M:%S %Z", time.localtime())) ============================================================ --- wrapper.py 3b1dd4c69017b12d2fbbc2ffc421dd3735424c94 +++ wrapper.py f7cb39709eb28cd4a813ef00e8f2e5ac2086dfa0 @@ -11,6 +11,7 @@ import re from monotone import Monotone +from template import Template # paranoid sane_uri_re = re.compile('^\w+$') @@ -119,7 +120,10 @@ try: if uri.endswith('.psp') and sane_uri_re.match(uri[:-4]): req.content_type = "text/html" - vars = { 'mt' : Monotone(config.monotone, config.dbfile) } + vars = { + 'mt' : Monotone(config.monotone, config.dbfile), + 'template' : Template() + } req.register_cleanup(cleanup, (req, vars)) template = psp.PSP(req, filename=uri, vars=vars) template.run()