[Zope] Setting the domain with setCookie and **kw?

Oleg Broytmann Oleg Broytmann <phd@phd.pp.ru>
Thu, 6 Sep 2001 12:17:39 +0400


On Thu, Sep 06, 2001 at 12:05:51AM -0400, Trevor Toenjes wrote:
> 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.

   setCookie("region", "moscow", expires="Thu, 21 Dec 1967 23:45:00", path="/foo",
      domain=".bar.com")

   expires gives the date/time of cookie expiration - the time a browser
will forget it and clear from its cookies file; without "expires" the
cookie will lasts only one session (while browser is up and running);

   path is an URL part that must match a request; without "path" browser
assumes the path of the current request;

   domain is... well, domain :) In .com, .org, .gov, .net, .edu it is
possible to set the 2nd-level domain (.ucsd.edu), in other TLDs you are not
allowed to set 2nd-level domains; use 3rd-level domains only (.foo.bar.mx).
Without "domain" broswer assumes current server's host (host, not domain).

Oleg.
---- 
     Oleg Broytmann     http://www.zope.org/Members/phd/     phd@phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.