[Zope] Setting the domain with setCookie and **kw?
Trevor Toenjes
zope@toenjes.com
Thu, 6 Sep 2001 00:05:51 -0400
To show I am trying. ;) I found this old post below that still leaves me
with some Q's.
How do you format setCookie to control the domain that is referenced?
example: setCookie auto-sets the subfolder address,
www.domain.com/sub1/sub2
BUT I want to set the cookie for the root URL without the sub-domain (www).
example: .domain.com is what I want to write in the cookie to share across
sub-domains.
What is **kw? in setCookie(name, value, **kw)
It is referenced many times in Appendix B: Zope Book.
Thanks for the help!
-Trevor
////old post
> Zope reference gives such a header for this method:
> setCookie(name, value, **kw),
> but the **kw argument is not described. What it is?
>
setCookie is a convenience function to construct the response
header. As this rfc header can have some additional attributes,
they can be given to the setCookie() method too.
Useful options are:
- expires this should be set to a date/time in the Future, where
the cookie is to be expired (hence the name ;)
The format is Wdy, DD-Mon-YYYY HH:MM:SS GMT,
so you might want to use DateTime().strftime() here.
- path At least if you set "expires" you should send a path
(minimum /) from which the cookie should work. Otherwise
it gets not stored for old Netscape versions and a few
proxies (Novell Bordermanager[tm] is known to behave like this)
- domain The domain for which the cookie has to be send for each
request. This defaults to the exact hostname of the server.
- secure you can specify this with secure='' to get the browser sending
it only over ssl.
HTH
Tino Wildenhain