REQUEST and AccessRule
Hi, It seems that REQUEST data available in a script executed as access rule are different from those usually available. How can I find the ones available ? In my case, I need to have the (external) hostname (running behind Apache and a VirtualHostMonster) in an access rule script. Thanks in advance --Gilles
Gilles Lenfant wrote:
It seems that REQUEST data available in a script executed as access rule are different from those usually available.
How can I find the ones available ?
The easiest way is to make an Access Rule Script like this: ##parameters=folder, request ## request.set('ARTEXT', str(request)) ...and then use a ZPT or DTML Method to display REQUEST['ARTEXT']. Cheers, Evan @ 4-am
Gilles Lenfant wrote at 2003-10-1 18:12 +0200:
It seems that REQUEST data available in a script executed as access rule are different from those usually available.
They are mostly the same: "AUTHENTICATED_USER" is not yet defined and "SESSION" may not yet be defined. "URL*" variables do not yet give the final results. Not all "BASE*" variables are defined.
How can I find the ones available ?
You could try "REQUEST.keys()"...
In my case, I need to have the (external) hostname (running behind Apache and a VirtualHostMonster) in an access rule script.
Unless Apache puts this information into the environment, it is not available at all. Please read the Apache "mod_rewrite" documentation how to put some information into the environment. Dieter
Dieter Maurer wrote:
Unless Apache puts this information into the environment, it is not available at all. Please read the Apache "mod_rewrite" documentation how to put some information into the environment.
Putting data into apache's environment doesn't do you any good if ZServer's environment isn't inherited from apache, which it is when you use the Zope.cgi & mod_rewrite technique, but it is not when you use the mod_rewrite & mod_proxy technique (which is the more common way to do things these days, and appears to be how Gilles is set up). -- Jamie Heilman http://audible.transient.net/~jamie/ "...thats the metaphorical equivalent of flopping your wedding tackle into a lion's mouth and flicking his lovespuds with a wet towel, pure insanity..." -Rimmer
----- Original Message ----- From: "Dieter Maurer" <dieter@handshake.de> To: "Gilles Lenfant" <gilles@pilotsystems.net> Cc: <zope@zope.org> Sent: Wednesday, October 01, 2003 9:59 PM Subject: Re: [Zope] REQUEST and AccessRule
Gilles Lenfant wrote at 2003-10-1 18:12 +0200:
It seems that REQUEST data available in a script executed as access rule are different from those usually available.
They are mostly the same:
"AUTHENTICATED_USER" is not yet defined and "SESSION" may not yet be defined.
Yes, the ZPublisher machinery seems to process security stuffs *after* pre traversal hooks like access rules. And I didn't find how to tweak the execution order of those pre traversal hooks when they're in the same container (access rule, session machinery, localizer...)
"URL*" variables do not yet give the final results. Not all "BASE*" variables are defined.
How can I find the ones available ?
You could try "REQUEST.keys()"...
Evan Simpson (thanks again) gave me the enlightenment (out of Zope ML): acces rule scripts receive 2 parameters : the folderish that contains the access rule and the request (didn't see any mention to this is the docs). Thus, such python scripts should contain... ... ##parameters=kontainer, request ... So you can check the REQUEST content at that stage with this in that access rule script : request.set('accessrulerequest', str(request)) ...and show it in any ZPT or DTML.
In my case, I need to have the (external) hostname (running behind Apache and a VirtualHostMonster) in an access rule script.
Unless Apache puts this information into the environment, it is not available at all. Please read the Apache "mod_rewrite" documentation how to put some information into the environment.
I use the ZServer that can't access to Apache environment. I don't want to use the Zope CGI mode. Anyway, I found what I wanted Thanks Dieter -- Gilles
participants (4)
-
Dieter Maurer -
Evan Simpson -
Gilles Lenfant -
Jamie Heilman