[Zope-dev] standard_error_message and displaying non-html content.

seb bacon seb@jamkit.com
Wed, 17 Oct 2001 16:04:15 +0100


I don't believe there is a clean way.  I've changed the source not to
display its own html at all.  It's not nice, but I suppose that's the
benefit of OSS.  These days I have a whole pile of patches I have to
apply to each Zope I install :S

seb

* Noel Duffy <noel.duffy@propylon.com> [011017 14:55]:
> 
> I have a zope site where users can access content using either html
> browsers and non-html devices, wap/wml, voicexml etc. I want to
> customize the standard_error_message dtml document to display errors
> in the appropriate format for each user. For example, if a user tries
> to access a non-existent url from a wml browser, they should get a
> nice wml page back saying that the page was not found.
> 
> Heres the problem. Although I have customized standard_error_message
> to display a page in the right format, the code in
> ZPublisher/HTTPResponse.py (exception method of HTTPResponse class)
> checks the error page I generate and, if it doesn't see "<html>" or
> "<!doctype html" at the start of the page, it wraps my page in some
> html by calling _error_html. Thus I get a small wml page wrapped in
> html :-( It makes no difference what the content-type header is set to
> - I'm setting that correctly for the users browser.
> 
> Is there any clean way I can alter this behaviour short of changing
> the code in ZPublisher/HTTPResponse.py? I say clean because I
> did find a rather ugly hack that will work - it involves replacing
> a method of the RESPONSE object at run-time. Not nice!
> 
> Thanks in advance
> 
> Noel Duffy.