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

Roger Erens rlwm.erens@home.nl
Thu, 06 Sep 2001 07:41:05 +0200


At 06:05 6-9-01, you wrote:
>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

Hello cookiemonster Trevor,

when you see a function x(arg1, *args) it means that x really NEEDS the 
first argument arg1 and CAN handle a bunch of extra arguments following 
arg1. The size of the bunch ( a tuple in Python-speach) is arbitrary, i.e. 
x(arg1, arg2, arg3) is just as well as is x(arg1, arg2, arg3, arg4, arg5) 
or x(arg1). Of course arg1 must not be a part of this bunch of extra arguments.

When you see a function y(arg1, **kw) it means that y expects a bunch of 
keyword arguments (a dictionary in Python-speach) of the form 
keyword=''value'. The size of the bunch is arbitrary and again, arg1 must 
not be a one of the keywords in this bunch of extra keyword arguments.
E.g. y(arg1, kw1='foo', kw2='bar', kw3='baz')

See also sections 4.6 and 4.7 of the python tutorial 
http://www.python.org/doc/current/tut/tut.html for the original explanation.

Hope this helps,

Roger