[Zope] Setting a Cookie

Tommy Johnson tommy@7x.com
Fri, 18 May 2001 15:12:08 -0800


Hey all,

I'm trying to set a cookie. Simple right? hehe - if so, then I wouldn't 
be here.  ;-)

Ok, I have the syntax in front of me. I have this bit of code to set 
the cookie:

<dtml-call "RESPONSE.setCookie('CookieMonster', '458468')">

All is well when I save the dtml document and when I run the page. The 
problem - the cookie isn't set!

Now I remember this problem when I worked with ASP. It turns out that 
you had to set an expire date also (although they said that if you 
didn't, the cookie expires when you close the browser and nothing gets 
written to the client machine.) That would be good - IF ONLY I COULD 
ACCESS THE INFORMATION I SET.

Sorry 'bout that. But it's fustrating to see this problem come up again 
with another language.

So I set an expire date. But, get this, now it fails when the page is 
loaded. The error message says that the method expected three 
parameters, but received four. Do you see four parameters here?

<dtml-call "RESPONSE.setCookie('CookieMonster', '458468', 'Sunday 20-05-
2001 12:00:00 GMT')">

I initially had a comma between Wdy, Date - because that is the 
DOCUMENTED syntax, but this seems incorrect also.

Here's the error message:

Error Type: TypeError
Error Value: too many arguments; expected 3, got 4

Any suggestions? Proven code would be appreciated.

Thanks in advance,
Tommy