[Zope-dev] standard_error_message does nothing?

Alexandre A. Rodioukov simuran@home.com
05 Dec 2000 02:37:32 -0700


Well, I'll try to share some Zope zen obtained after fighting with "weird
standard_error_message behaviour" phenomena.

It might sound very weird, but to make standard_error_message behave it
should/you expect it to, it must contain sufficient HTML to properly show
itself. Don't ask why... I don't know :)

Seems that this works fine:

[standard_error_message]
<html>
<body>
  <dtml-var error_type>
</body></html>


In contrast with following, which does not work as expected:

[standard_error_message]
<dtml-var standard_html_header>
  <dtml-var error_type>
<dtml-var standard_html_footer>

[standard_html_header]
<html>
<body>

[standard_html_footer]
</body></html>


Though, you need to make sure that any DTML code included in
standard_error_message would not raise any exceptions (NotFound, KeyError
etc...). In this case Zope will render error message that is defined in 
_error_html() in HTTPResponse.py, which is fine.

OTOH, above hack works with almost all error types, but Unauthorized.

Can anyone provide any sound explanation? Also, are there any _proper_ ways
of redefining error message in Products? And why is it so, that (at least
in 2.2.x) you can not remove standard_html_[header|footer] from Zope root?
Does it have anything to do with being mentioned in /standard_error_message?

Regards, Alex.

--
Complex problems have simple, easy-to-understand wrong answers.