[Zope] Problem redirecting from standard_error_message

Peter Hernberg petehern@yahoo.com
Fri, 6 Jul 2001 08:09:19 -0700 (PDT)


Having moved our website to zope, there are a number of pages that have
different URLs now. I've written a little script that checks the urls returns
the new url if the page has moved. Then I edited standard_error_message as
follows:

<dtml-let new_path="temp.translate(REQUEST['URL'])"> <--- returns the new url
  <dtml-if "error_type=='NotFound' and new_path">
    <dtml-call "RESPONSE.setStatus('MovedPermanently')">
    <dtml-call "RESPONSE.setHeader('Location', new_path)"> <--- As per rfc, this
tells the client where the page has moved to
    <html>
    <body>
    This page has moved <a href="<dtml-var new_path>">here</a>.
    </body>
    </html>
  <dtml-else>
    ...normal standard_error_message...
  </dtml-if>
</dtml-let>

This doesn't work. The Location gets set, but the status is still 404 (which
means the browsers won't automatically be redirected to the new page). This code
works in a regular dtml method, but standard_error_message seems to be doing
some magic which prevents the call to RESPONSE.setStatus() from working. Is
there a way around this? Is there a better way to do this? Or did I miss
something obvious (again:)?

=====
Peter Hernberg
According to Securityportal.com, I'm an "ironic and humorous... security expert." Ain't it cool?
http://www.securityportal.com/articles/ramen20010119.printerfriendly.html


"You must pass this message on in the next 72 hours or you will have bad luck. This mantra will come true even if you aren't superstitious!!!!" --from a forwarded email

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/