A version of Section 17, “buildErrorPage()” that writes
using sox.py: Sequential Output of XML
for Python. One
difference is that unlike the former method, we can't
retroactively change the page and body titles, because
they've already been written.
The moving Finger writes, and having writ,
Moves on, nor all your Piety nor Wit,
Shall lure it back to cancel half a Line,
Nor all your Tears wash out a Word of it.
Omar Khayyam, The Rubáiyát
(Edward FitzGerald translation)
# - - - b u i l d E r r o r S o x
def buildErrorSox(sox, page, x):
'''Modify the page to show an error message.
[ (sox is a sox.Sox instance) and
(page is an open tp.TCCPage instance) and
(x is an Exception) ->
sox +:= an error message ]
'''
sox.leaf("p", "Error: %r" % str(x))