[Zope] Setting a Cookie

Tino Wildenhain tino@wildenhain.de
Sat, 19 May 2001 15:20:10 +0200


Hi Tommy,

--On Freitag, 18. Mai 2001 15:12 -0800 Tommy Johnson <tommy@7x.com> wrote:

> 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!

How do you detect this? Try <dtml-var REQUEST>
to see if your cookie gets set.

I use this code for temporary Cookies and it works.

Regards
Tino

> 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
>
>
> _______________________________________________
> 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 )