On the debugging of page templates

... and form controllers and macros and webforms ...

Try embedding something like this in your code:

<dl class="collapsible inline collapsedOnLoad">
<dt class="collapsibleHeader">Title</dt>
<dd class="collapsibleContent">
<span tal:replace="structure python: here.printRequest(request,
errors)"/> </dd>
</dl>

and supply the necessary printRequest somewhere in your code or as a script:

def printRequest (self, request, errors):
   req = dict(request)
   buf = StringIO()
   buf.write ("<div>")
   buf.write ("<p><b>request:</b></p>")
   buf.write ("<ul>")
   for k, v in req.iteritems():
      buf.write ("<li>%s: %s</li>" % (k, v))
      buf.write ("</ul>")
      buf.write ("<p><b>errors:</b></p>")
      buf.write ("<ul>")
      for k, v in errors.iteritems():
         buf.write ("<li>%s: %s</li>" % (k, v))
         buf.write ("</ul>")
         buf.write ("</div>")
         return buf.getvalue()