# # # add_file "common.py" # content [63e15e4815638f001c26722a4bac42e7690caa63] # # add_file "error.psp" # content [86698bf03d1ef29f0693747d5bb2861969317bf8] # # patch "index.psp" # from [d861d65c4ec05c4a925d3ecc1ebe34dc6aa9ae13] # to [68198f75c1cab5f56db246c51ef178357826b589] # ============================================================ --- common.py 63e15e4815638f001c26722a4bac42e7690caa63 +++ common.py 63e15e4815638f001c26722a4bac42e7690caa63 @@ -0,0 +1,6 @@ + +def html_escape(): + "returns a function stolen from pydoc that can be used to escape HTML" + import pydoc + return pydoc.HTMLRepr().escape + ============================================================ --- error.psp 86698bf03d1ef29f0693747d5bb2861969317bf8 +++ error.psp 86698bf03d1ef29f0693747d5bb2861969317bf8 @@ -0,0 +1,47 @@ + +
++An error has occurred: +
+ ++<%= hq(str(e_value)) %> +
+ ++If necessary, please report this error to the system administrator. You may wish to return +to the index page. +
+ +<% +else: +%> ++<% + import traceback + mesg = traceback.format_exception(e_type, e_value, e_traceback) + mesg = map(hq, mesg) + req.write('
' + '') +%> + + + + ============================================================ --- index.psp d861d65c4ec05c4a925d3ecc1ebe34dc6aa9ae13 +++ index.psp 68198f75c1cab5f56db246c51ef178357826b589 @@ -6,13 +6,23 @@ reload(monotone) from monotone import Monotone +hq = common.html_escape() mt = Monotone(config.monotone, config.dbfile) -req.write("Branches: %s" % (str(mt.get_branches()))) + +psp.set_error_page("error.psp") + %> -ViewMTN +
'.join(mesg) + '