How to redirect any URL to a base URL using siteAccess was:(REQUEST.path)
Hi Peter, Thanks for the help, although I think that REQUEST.path is a list and not a dictionary, as seen from querying it directly. Anyhow, what I searched for was REQUEST.path.pop() which allowed me to drop bits off the end. For anyone interested, here is the code I eventually figured out: <dtml-unless "REQUEST.path[0][:6]=='manage' or REQUEST.path[-1][:6]=='manage'"> <dtml-call Session> <dtml-var logic> <dtml-in "REQUEST.path" reverse> <dtml-unless "_['sequence-item']=='indir'"> <dtml-call "REQUEST.path.pop()"> </dtml-unless> </dtml-in> <dtml-call "REQUEST.path.append('get')"> </dtml-unless> This allows a user to access any path where the SiteRule sits in a root directory, called 'indir' This process rule will intercept absolutley ANYTHING passed in its path and rediret it to one page called get. Could be usefull for those who are transporting a legacy site structure into Zope and want to get rid of hundreds of files that NEED to be there, but actually arent in Zope. I use is for product updates that use a directory based GET to our website and the find a file that has html that say 'Update available'. Now I simply use the 'get' document to pick apart that path that was used and then query a database for update results.... Cheers, Paz -----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Peter Bengtsson Sent: Wednesday, July 04, 2001 12:03 PM To: Paul Zwarts; Zope Subject: Re: [Zope] REQUEST.path REQUEST is a construction by Zope. It has predefined functions called set() or has_key() path is a natural python dictionary and doesn't have functions such as set() or replace() path is a dictionary _inside_ the REQUEST class, just like this: class R: path={} def set(self,k,v):R.path[k]=v r= R() r.set('o',1) print r.path ----- Original Message ----- From: "Paul Zwarts" <paz@oratrix.com> To: "Zope" <zope@zope.org> Sent: Wednesday, July 04, 2001 10:40 AM Subject: [Zope] REQUEST.path
Greetings,
I use the following code in a site rule which works:
<dtml-call "REQUEST.path.append('something')"> <dtml-return " 'ignored' ">
But I want to use path.set or path.replace, which dont do anything? What am I doing wrong?
Thanks, Paul Zwarts
_______________________________________________ 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 )
_______________________________________________ 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 )
participants (1)
-
Paul Zwarts