Cookies seem to disappear

Ulf Engström ulf.engstrom at
Thu Dec 7 04:52:24 EST 2000

The browser will only save the cookie if you specify where the cookie later
will be used, that means, you have to set the Domain of the cookie:
c['state']['Domain'] = ''
Also, not all (old) webservers handle max-age correctly, and if you still
have problems after adding domain to your cookie, maybe just try Expires
instead of max-age.
Cookies explained:

> Hi,
> I am trying to use SmartCookie class to store state.  Everything works
> perfectly until I exit my browser.  The next time I try to view the page
> my state has been reset to the default values.  I set the 'max-age'
> value like  so:
> c = Cookie.SmartCookie()
> c['state'] = stateDictionary
> c['state']['max-age'] = '3600'
> print c.output()
> print
> I've tried Netscape on WinNT and Linux and IE on WinNT, they all exhibit
> same behaviour.  The thing that is throwing me is that everything works
until I
> exit my browser.  It is as if I'm not setting the max-age correctly but
> how difficult can that be?
> Thanks for your help.
> --dennism
> --

More information about the Python-list mailing list