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