[Zope] Setting a Cookie

Paula Mangas pamm@students.si.fct.unl.pt
Sat, 19 May 2001 00:30:45 +0100 (WEST)



Hi!




On Fri, 18 May 2001, Bruce Eckel wrote:

> The first parameter is "self", which is implicit during the
> call (you could say it's explicit because it's a method
> call). So if it looks like you're passing three arguments
> to a method call, it's actually getting four.
>
> Not a cookie expert, but I found an earlier message about
> cookies this week with the example:
> <dtml-call "RESPONSE.setCookie('voted_in_poll', '1')">


Yes, you are setting a cookie with "voted_in_poll" name and value "1". The
fact is that you can have more parameters on cookie. For more details see
the HTTPResponse.py file (you can find it on ZPublisher directory).


Paula Mangas



>
> FWIW
>
> *********** REPLY SEPARATOR  ***********
>
> On 5/18/01 at 3:12 PM Tommy Johnson 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!
> >
> >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 )
>
>
>
> Most current information can be found at:
> http://www.mindview.net/Etc/notes.html
> ===================
> Bruce Eckel    http://www.BruceEckel.com
> Contains free electronic books: "Thinking in Java 2e" &
> "Thinking in C++ 2e"
> Please subscribe to my free newsletter -- just send any
> email to:
> join-eckel-oo-programming@earth.lyris.net
> My schedule can be found at:
> http://www.mindview.net/Calendar
> ===================
>
>
>
> _______________________________________________
> 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 )
>

-- 

============================================================
 Quando tiver duvidas, nao questione aqueles que so' tem
 certezas, pois corre o risco de ficar com mais duvidas!...
------------------------------------------------------------
Paula Monteiro Mangas

e-mail: Paula.Mangas@mail.com
URL:	http://students.fct.unl.pt/~pamm/
TMV:    (+351) 96 2559034
============================================================