[Zope-dev] __before_publishing_traverse__ calls RESPONSE.redirect(): is there another way to change the browser URL?
Oliver Bleutgen
myzope@gmx.net
Fri, 27 Sep 2002 21:44:44 +0200
Craeg K Strong wrote:
> I believe HTTP_REFERER will list the place from whence you were redirected,
> but unfortunately it does not distinguish between
>
> "redirect" and
>
> "following HTML link"
>
> Of which my application has many :-(
Ok, then here are two other ideas:
1. in your redirect to an acquired method which itself redirects back to
the document, this creates a HTTP_REFERER header which will tell you
that it - via this method - came from your application:
raise 'Redirect',newURL+'/I_am_just_here_to_show_the_special_redirect'
where 'I_am_just_here_to_show_the_special_redirect'
is a python script which just does
context.REQUEST.RESPONSE.redirect(context.absolute_url())
I don't know ATM if you need perhaps context.aq_parent.absolute_url().
Now inspect HTTP_REFERER.split('/')[-1].
But note that HTTP_REFERER is not secure, because it's sent by the
client, and some privacy tools/proxies might suppress it.
2. use cookies, which have their own problems.
Or, use both methods.
cheers,
olive