More questions about standard_error_message
A couple of questions about the behaviour of standard_error_message - I've asked one of these on this list before and didn't get a reply, so probably won't get a reply now, but I've been really scratching my head and sifting around through all the different Zope resources for an answer. It'd be much appreciated if anyone, particularly at DC, has any comments. First question is about getting standard_error_message to redirect. RESPONSE.redirect() calls don't work in standard_error_message, while they do in other contexts. The reason I'm doing this is to take a 404 error, look up the intended URL in a database table and transparently redirect to a new URL if one has been defined. Otherwise it displays a normal "not found" error. Is there any way of getting this redirection to happen? I'm also interested as to why it doesn't happen, since the DTML contents is presumably being parsed by Zope in the same way other documents are... but perhaps it isn't. The second question is about overriding the standard_error_message seen for a given folder. What I'd like to be able to have is: /standard_error_message foo/ standard_error_message bar/ baz/ Thus, errors occuring within foo/ use a different standard_error_message to those elsewhere. However, this doesn't appear to happen so I can only presume the standard_error_message called is always the one in the root. Is there any way around this other than to explicitly check the URL causing the error and take the appropriate action? Ditto goes for a property such as ErrorsTo containing, say, the e-mail address of someone to report errors to. If I have: /ErrorsTo = webmaster@foo.org foo/ bar/ ErrorsTo = bar-errors@foo.org baz/ ErrorsTo = errors@baz.com I'd like standard_error_message to acquire the appropriate ErrorsTo property, but unfortunately this doesn't happen and the ErrorsTo property will always be webmaster@foo.org for standard_error_message. I've rummaged through the docs on Zope.org, searched the mailing lists and even had a nose around the source without much luck. Anyone have information about standard_error_message? Anything learnt will be documented and put onto the Zope site, I've already made a start but these two topics are frustrating to solve. 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.
John Chandler wrote:
around through all the different Zope resources for an answer. It'd be much appreciated if anyone, particularly at DC, has any comments.
Well, I'm not from DC, but I'll see what I can do. :)
The second question is about overriding the standard_error_message seen for a given folder. What I'd like to be able to have is:
/standard_error_message foo/ standard_error_message bar/ baz/
Thus, errors occuring within foo/ use a different standard_error_message to those elsewhere. However, this doesn't appear to happen so I can only presume the standard_error_message called is always the one in the root. Is there any way around this other than to explicitly check the URL causing the error and take the appropriate action?
Your example works for me . . . How exactly are you raising the error? 1) If you're playing some games with acquisition, make sure you're actually calling the standard_error_message you think you are. Say there's a method, "AnError" in your root directory that raises an error. If it's called as "/foo/AnError", you'll get the error message from /foo, but if you call it as "/foo/bar/AnError", you'll get the error message from the root folder. 2) Are you sure you're getting to your error message at all? If there's an error of some sort in standard_error_message itself, Zope will\ display a default error message that's *not* a standard_error_message anywhere. This could possibly be related to your RESPONSE.redirects you were trying before.
Ditto goes for a property such as ErrorsTo containing, say, the e-mail address of someone to report errors to. If I have:
/ErrorsTo = webmaster@foo.org foo/ bar/ ErrorsTo = bar-errors@foo.org baz/ ErrorsTo = errors@baz.com
I'd like standard_error_message to acquire the appropriate ErrorsTo property, but unfortunately this doesn't happen and the ErrorsTo property will always be webmaster@foo.org for standard_error_message.
Again, how are you raising the errors . . . The acquisition stuff I mentioned before can bite you here, too. Hope any of this helps! -CJ
participants (2)
-
Christopher J. Kucera -
John Chandler