I'm currently trying to modify Zope's standard error pages in order to have errors (such as 404 not founds or DTML errors) e-mailed to the webmaster as they occur. At first, I thought this would be as simple as modifying the standard_error_message document found in the root of the Zope installation, but it appears that changes to the file do not get displayed (even after forced refreshes) and thus it doesn't seem to be in use. A search on zope.org lead me to find the real error message embedded in <zopedir>/lib/python/OFS/Application.py - I've modified this and it appears to work, but doesn't support HTTP related errors such as 404s. After a bit of a search, I've tracked down HTTP-related error reports to <zopedir>/lib/python/ZPublisher/HTTPResponse.py but, while this can be modified, it doesn't support DTML as the HTML error message is returned without apparently being parsed by Zope. As a result, I can't have dtml-sendmail send an error message report. Okay, I could modify HTTPResponse.py to send a mail using something like Python's smtplib, but before I do that, have I overlooked the obvious and is there really a much cleaner, easier way to modify the error pages without delving into the sources? Thanks in advance! John -- John Chandler / Software Developer / New Information Paradigms Ltd [ Linux in the office, AmigaOS in the home, PalmOS in the pocket ] ------------------------------------------------------------------------ The opinions above aren't those of my company... ...but then, they aren't really mine either.
On Tue, Mar 21, 2000 at 02:24:47PM +0000, John Chandler wrote:
I'm currently trying to modify Zope's standard error pages in order to have errors (such as 404 not founds or DTML errors) e-mailed to the webmaster as they occur.
At first, I thought this would be as simple as modifying the standard_error_message document found in the root of the Zope installation, but it appears that changes to the file do not get displayed (even after forced refreshes) and thus it doesn't seem to be in use.
A search on zope.org lead me to find the real error message embedded in <zopedir>/lib/python/OFS/Application.py - I've modified this and it appears to work, but doesn't support HTTP related errors such as 404s.
After a bit of a search, I've tracked down HTTP-related error reports to <zopedir>/lib/python/ZPublisher/HTTPResponse.py but, while this can be modified, it doesn't support DTML as the HTML error message is returned without apparently being parsed by Zope. As a result, I can't have dtml-sendmail send an error message report.
Okay, I could modify HTTPResponse.py to send a mail using something like Python's smtplib, but before I do that, have I overlooked the obvious and is there really a much cleaner, easier way to modify the error pages without delving into the sources?
Have a look at: http://www.zope.org/standard_error_message/view_source and you'll see how the Zope.org site handles 404 Not Found. -- Martijn Pieters | Software Engineer mailto:mj@digicool.com | Digital Creations http://www.digicool.com/ | Creators of Zope http://www.zope.org/ | The Open Source Web Application Server ---------------------------------------------
http://www.zope.org/standard_error_message/view_source
and you'll see how the Zope.org site handles 404 Not Found.
Martijn, I think the problem is that any changes made to standard_error_message don't appear to have any effect. I've tried just simply changing the text, add ' - wibble' after 'Zope Error' and the old error message is still displayed, even after restarting Zope... What's going on? Is there some method such like with SiteAccess that you have to 'set' a DTML method as the standard error message or is something else causing the old error message to be displayed? HYCH, Chris
On Tue, Mar 21, 2000 at 03:04:59PM +0000, Chris Withers wrote:
http://www.zope.org/standard_error_message/view_source
and you'll see how the Zope.org site handles 404 Not Found.
Martijn,
I think the problem is that any changes made to standard_error_message don't appear to have any effect. I've tried just simply changing the text, add ' - wibble' after 'Zope Error' and the old error message is still displayed, even after restarting Zope...
What's going on?
Is there some method such like with SiteAccess that you have to 'set' a DTML method as the standard error message or is something else causing the old error message to be displayed?
I have no idea. I don't use SiteAccess, so I don't know what influence it has on this issue. I can change standard_error_message just fine here. Try and understand what the default code does first, then try and make a few educated-guess changes to that code. Does anything show up in the undo log? After a change, does the edit window have a message 'Content changed [Date]' just below the tabs? -- Martijn Pieters | Software Engineer mailto:mj@digicool.com | Digital Creations http://www.digicool.com/ | Creators of Zope http://www.zope.org/ | The Open Source Web Application Server ---------------------------------------------
On Tue, 21 Mar 2000 15:04:59 +0000, Chris Withers <chrisw@nipltd.com> wrote:
I think the problem is that any changes made to standard_error_message don't appear to have any effect. I've tried just simply changing the text, add ' - wibble' after 'Zope Error' and the old error message is still displayed, even after restarting Zope...
This is what happens when an exception is raised while rendering standard_error_message (obtained through acquisition). ZPublisher renders the default standard_error_message, rather than let a problem go unreported. Toby Dickenson tdickenson@geminidataloggers.com
Sorry to butt in on an ongoing conversation, but: Is it possible to do a redirect if a NotFound error is reported. I'm trying to do this right now and failing miserably. Any insight? TIA Phil phil.harris@zope.co.uk ----- Original Message ----- From: "Toby Dickenson" <mbel44@dial.pipex.net> To: "Chris Withers" <chrisw@nipltd.com> Cc: "Martijn Pieters" <mj@digicool.com>; "Zope Mailing List" <zope@zope.org>; "John Chandler" <johnc@nipltd.com> Sent: Tuesday, March 21, 2000 3:52 PM Subject: Re: [Zope] Modifying Standard Error Pages
On Tue, 21 Mar 2000 15:04:59 +0000, Chris Withers <chrisw@nipltd.com> wrote:
I think the problem is that any changes made to standard_error_message don't appear to have any effect. I've tried just simply changing the text, add ' - wibble' after 'Zope Error' and the old error message is still displayed, even after restarting Zope...
This is what happens when an exception is raised while rendering standard_error_message (obtained through acquisition).
ZPublisher renders the default standard_error_message, rather than let a problem go unreported.
Toby Dickenson tdickenson@geminidataloggers.com
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
On Tue, Mar 21, 2000 at 04:10:02PM -0000, Phil Harris wrote:
Sorry to butt in on an ongoing conversation, but:
Is it possible to do a redirect if a NotFound error is reported.
I'm trying to do this right now and failing miserably.
Any insight?
Have you looked at the Zope.org error message and played with that? You should be able to do a RESPONSE.redirect I think. -- Martijn Pieters | Software Engineer mailto:mj@digicool.com | Digital Creations http://www.digicool.com/ | Creators of Zope http://www.zope.org/ | The Open Source Web Application Server ---------------------------------------------
Martijn, Yeah I look and even copied the code and fixed it to work on my server but doing a redirect doesn't seem to work. At best I get a blank page with no redirect taking place. Oh well, I'll keep on experimenting. See ya Phil phil.harris@zope.co.uk ----- Original Message ----- From: "Martijn Pieters" <mj@digicool.com> To: "Phil Harris" <phil.harris@zope.co.uk> Cc: <tdickenson@geminidataloggers.com>; "Chris Withers" <chrisw@nipltd.com>; "Zope Mailing List" <zope@zope.org>; "John Chandler" <johnc@nipltd.com> Sent: Tuesday, March 21, 2000 4:16 PM Subject: Re: [Zope] Modifying Standard Error Pages
On Tue, Mar 21, 2000 at 04:10:02PM -0000, Phil Harris wrote:
Sorry to butt in on an ongoing conversation, but:
Is it possible to do a redirect if a NotFound error is reported.
I'm trying to do this right now and failing miserably.
Any insight?
Have you looked at the Zope.org error message and played with that? You should be able to do a RESPONSE.redirect I think.
-- Martijn Pieters | Software Engineer mailto:mj@digicool.com | Digital Creations http://www.digicool.com/ | Creators of Zope http://www.zope.org/ | The Open Source Web Application Server ---------------------------------------------
I think the problem is that any changes made to standard_error_message don't appear to have any effect. I've tried just simply changing the text, add ' - wibble' after 'Zope Error' and the old error message is still displayed, even after restarting Zope...
This is what happens when an exception is raised while rendering standard_error_message (obtained through acquisition).
ZPublisher renders the default standard_error_message, rather than let a problem go unreported.
Yup, just discovered this myself. :-) I put a buggy dtml expression in the document and Zope displays a default message rather than the custom one I've generated - removing the buggy stuff brings the custom version. Thanks to Martin for pointing me to the 404 handling on zope.org, I've solved the initial problem I was having with getting changes recognised in the standard_error_message in Zope's root, and now have it mailing a basic error report to the webmaster. There are a few issues Chris noticed when he was doing some stuff, but I'm going to take a look at these further before posting more on the subject. Cheers, John -- John Chandler / Software Developer / New Information Paradigms Ltd [ Linux in the office, AmigaOS in the home, PalmOS in the pocket ] ------------------------------------------------------------------------ The opinions above aren't those of my company... ...but then, they aren't really mine either.
participants (5)
-
Chris Withers -
John Chandler -
Martijn Pieters -
Phil Harris -
Toby Dickenson