[Zope] The persistent variable

Geir Bækholt lists at elvix.com
Fri Sep 5 12:58:28 EDT 2003


On  Fri, 5 Sep 2003 11:43:06 +0200 GMT 
Børge Kjeldstad asked the Zope mailinglist about the following:

> However, I did not find an easy way to do this. My next plan was then to
> use cookies:
> <dtml-call expr="RESPONSE.setCookie('guest', 'C')">
> And this:
> <dtml-if expr="REQUEST.has_key('guest', 'C')">
>   <dtml-var site_map>
> </dtml-if>

I now think i understand what you are trying to do.

if you try the following :
   <dtml-if expr="REQUEST.get('guest')=='C'">
or, following Chris' advice:
   <dtml-if expr="REQUEST.cookies.get('guest')=='C'">
I think you can accomplish what you are after.

REQUEST.has_key() will return you true or false dependant on whether the key
exists in the Request, so you can check if the cookie exists(but not
it's value) by doing REQUEST.has_key('guest')

:)


--
Geir Bækholt




More information about the Zope mailing list