[Zope] Problem redirecting from standard_error_message
Alan Capesius
alanc@tech-world.com
Fri, 6 Jul 2001 10:42:50 -0500
You need to change the header to a redirect.
Look at this excellent how-to:
http://www.zope.org/Members/JohnC/StandardErrorMessage
You might look at using an AccessRule to do this instead of
standard_error_message
http://www.zope.org/Members/4am/SiteAccess2/otheruse
> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Peter
> Hernberg
> Sent: Friday, July 06, 2001 10:09 AM
> To: zope@zope.org
> Subject: [Zope] Problem redirecting from standard_error_message
>
>
> 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/
>
> _______________________________________________
> 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 )
>