How to get name of calling DTML or script..
I have a python script which needs to redirect the browser to the page that called the script. In other words, if I am on the a page called "test" and I call a script named "blah", I want the blah script to do the following (among other things): ... context.request.RESPONSE.redirect(x) where x is the name or URL of the page that called the script. Make sense? Any ideas? Kevin
x = request.HTTP_REFERER so, RESPONSE.redirect(request.HTTP_REFERER) will reload the page that called the script... Kevin Carlson wrote:
I have a python script which needs to redirect the browser to the page that called the script. In other words, if I am on the a page called "test" and I call a script named "blah", I want the blah script to do the following (among other things):
... context.request.RESPONSE.redirect(x)
where x is the name or URL of the page that called the script. Make sense? Any ideas?
Kevin
_______________________________________________ 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 )
-- Jason Bush --- jason@nol.org Nebraska Online http://www.nol.org
Hello Jason, Wednesday, July 10, 2002, 11:02:24 PM, you wrote: JB> x = request.HTTP_REFERER JB> so, RESPONSE.redirect(request.HTTP_REFERER) JB> will reload the page that called the script... ..most of the time.. HTTP_REFERER is an *optional* HTTP-HEADER that most clients/browsers send with the request , but they are not required to do so. I know that at least in Opera there is an option to turn it off for those concerned with privacy.. - Just so that no one relies on it for important stuff... -- Geir Bækholt web-developer geirh@funcom.com funcom oslo | webdev-team
Geir Bækholt wrote:
HTTP_REFERER is an *optional* HTTP-HEADER that most clients/browsers send with the request , but they are not required to do so. I know that at least in Opera there is an option to turn it off for those concerned with privacy..
- Just so that no one relies on it for important stuff...
...many people rely on this. I wasn't aware it was optional, but I guess for people that paranoid, they'll just have to suffer non-functional web sites ;-) cheers, Chris
Security conscious people have been dealing with broken websites for ages but that's not the point. HTTP_REFERER can, and often does, contain nothing or browser specific crap. For instance, you can type a URL directly into the browser. With auto completion so common, this is how I visit most websites. Generally, you won't get a referrer in these cases. More common is the bookmark issue. Some browsers pass browser specific (ie. crap) strings as the referrer in these cases. And then there is the case of deep linking resulting in referrers that not only aren't from your site but also contain whatever dynamic content gobblygook that site uses. Referrer is really only good for log analysis and figuring how who is slashdotting your site. Any other use is asking for trouble. IMHO, of course... Charlie Reiman
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Chris Withers Sent: Sunday, July 14, 2002 2:38 AM To: Geir Bækholt Cc: Jason Bush on the zope-list; Kevin Carlson; zope group Subject: Re: [Zope] How to get name of calling DTML or script..
Geir Bækholt wrote:
HTTP_REFERER is an *optional* HTTP-HEADER that most clients/browsers send with the request , but they are not required to do so. I know that at least in Opera there is an option to turn it off for those concerned with privacy..
- Just so that no one relies on it for important stuff...
...many people rely on this. I wasn't aware it was optional, but I guess for people that paranoid, they'll just have to suffer non-functional web sites ;-)
cheers,
Chris
_______________________________________________ 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 )
Kevin Carlson writes:
I have a python script which needs to redirect the browser to the page that called the script. In other words, if I am on the a page called "test" and I call a script named "blah", I want the blah script to do the following (among other things):
... context.request.RESPONSE.redirect(x)
where x is the name or URL of the page that called the script. Make sense? What you name the "browser page" is almost surely the object "REQUEST.PUBLISHED". You can ask it for its "absolute_url".
Dieter
participants (6)
-
Charlie Reiman -
Chris Withers -
Dieter Maurer -
Geir Bækholt -
Jason Bush -
Kevin Carlson