[Zope] sendmail tag is quoting html

Dieter Maurer dieter@handshake.de
Tue, 11 Mar 2003 23:37:34 +0100


AM wrote at 2003-3-10 12:03 -0800:
 > I have the following snippet in my standard_error_message:
 > ...
 > <dtml-sendmail mailhost="mail_host">
 > ...
 > <dtml-var error_tb>
 > ...
 > </dtml-sendmail>
 > 
 > The problem is that the error_tb is sent quoted like in the stuff below.
 > Any ideas why?? Any workarounds??
 > ....
 > Error Type: NotFound
 > Traceback:
 > 
 > <p>Traceback (innermost last):
 > <ul>
 > 
 > <li>  Module ZPublisher.Publish, line 89, in publish</li>
 > 
 > <li>  Module ZPublisher.BaseRequest, line 329, in traverse</li>
 > 
 > <li>  Module ZPublisher.HTTPResponse, line 636, in debugError</li>
 > 
 > </ul>

Up to hear, it is as expected:

  You are sending a plain text email while "error_tb" expects
  to be incorporated into an HTML context.

 > NotFound: &lt;TABLE BORDER="0" WIDTH="100%"&gt;
 > &lt;TR VALIGN="TOP"&gt;
 > 
 > &lt;TD WIDTH="10%" ALIGN="CENTER"&gt;
 > &amp;nbsp;
 > &lt;/TD&gt;
 > 
 > &lt;TD WIDTH="90%"&gt;
 >   &lt;H2&gt;Site Error&lt;/H2&gt;
 >   &lt;P&gt;An error was encountered while publishing this resource.
 >   &lt;/P&gt;
 >   &lt;P&gt;&lt;STRONG&gt;Debugging Notice&lt;/STRONG&gt;&lt;/P&gt;
 > 
 >   Zope has encountered a problem publishing your object.&lt;p&gt;
 > Cannot locate object at: http://nbs.neuro-bs.com/dadada
 >   &lt;HR NOSHADE&gt;

This is caused by the following problem:

  Usually, "error_value" should be HTML quoted, as it may
  contain e.g. "<SpecialException instance at 0x3456>"
  or other non-HTML text.

  However, some exceptions, e.g. "debugError" put HTML formatted text
  in "error_value". Of course, quoting this HTML does not
  enhance readability.

I do not have an easy solution.

  Probably, the exceptions that put HTML into "error_value"
  should derive from a special exception base class which
  would allow to treat them in a special way.

  Or, even better, all exceptions should delegate presentation
  to "standard_error_message" and do not try to HTML render
  error text.


Dieter