[Zope] PATH_INFO und regex

Sven Kirmess Sven Kirmess <sven.kirmess@gmx.net>
Fri, 1 Oct 1999 23:36:40 +0200


 Hi chas,

Friday, October 01, 1999, 8:10:30 PM, you wrote:


> dunno about the regex but in python, this is simply :

> if s[-1] != "/" :
>         s[:string.rfind(s, "/")]

> which i guess should be something like this :

> <dtml-if "s[-1]=='/'">
<dtml-if "s[-1]!='/'">
               ^
>         <dtml-call "REQUEST.set(s, s[:_.string.rfind(s, '/')])">
<dtml-call "REQUEST.set('s', s[:_.string.rfind(s, '/')])">
                        ^ ^
> </dtml-if>

> where s is your path_info (which you sub straight  into the above)

Yes. Thank you. Works great.

> not sure what you need this for but you might want to check URL1 also.

URL1 includes the domain, so for every "click" there will be a
DNS-request (the common Browsers don't cache DNS, IIRC).

I use this

<!--#call "REQUEST.set('path',PATH_INFO)" -->
<dtml-if "path[-1]!='/'">
        <dtml-call "REQUEST.set('path',SCRIPT_NAME+path[:_.string.rfind(path, '/')])">
</dtml-if>




<a href="<!--#path-->/">x</a>

and no DNS-request is needed.




 Sven

-- 
PGP-Key-ID: 0x881BF222