-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Ken Sent: Friday, November 22, 2002 3:57 PM To: zope@zope.org Subject: re: [Zope] dtml-try... again?
If no one minds, I'll repeat my question more clearly:
I am getting Key Errors, possible having to do with some remote HTTP calls. I don't know how to provoke the problem, it 'just happens' (revised estimate) 5-10% of the time.
The Key Error never happens twice, so requesting the page a second time always works. I was tempted to use something like this:
<dtml-try> <dtml-var "error_prone_method.view()"> <dtml-except KeyError> <dtml-call "RESPONSE.redirect(URL)"> </dtml-try>
I hate to be critical here but this is a bad, bad idea. You're creating an infinite loop that uses the client's browser as half of the loop. Imagine just how pleased they'll be when their browser starts flickering and not responding to their efforts to stop it. I know you said the error never happens more than once. Even if this is true, some other fault in the system might cause 100% failures in this section of code. If you truly believe the error only happens once and can never be fixed, then just: <dtml-try> <dtml-var "error_prone_method.view()"> <dtml-except KeyError> <dtml-var "error_prone_method.view()"> </dtml-try> At least this way you aren't dragging your visitor down with you.