[Zope] Cookie

Oliver Bleutgen myzope@gmx.net
Thu, 06 Feb 2003 18:08:08 +0100


Pino Silvestre wrote:
> I have a problem with cookies.
> 
> For example I have this code:
> 
> <dtml-if "REQUEST.has_key('myCookie')">
>   <dtml-var myCookie>
> <dtml-else>
> <dtml-call "RESPONSE.setCookie('myCookie', _.DateTime(), 
> expires=_.DateTime()+1)">
> <dtml-if>
> <dtml-var getCookie>
> 
> where getCookie is a simply DTML Method like this:
> 
> <dtml-if "REQUEST.has_key('myCookie')">
>   Ok cookie <dtml-var myCookie>
> <dtml-else>
>   No cookie
> </dtml-if>
> 
> Well, the result is this "No cookie". But the cookie have just been 
> setted. Do anybody explain me this strange behavior?

Well, the cookie isn't there, you have just told zope to send the cookie 
in the response.
It will be visible in the next request.


HTH,
oliver