Michael Foord fuzzyman at
Thu Aug 12 11:13:32 CEST 2004

jjl at (John J. Lee) wrote in message news:<87acx1qo1z.fsf at>...
> fuzzyman at (Michael Foord) writes:
> > Has anyone used ClientCookie to store cookies ? 
> > I'm going to play around with 'pickling cookies' - but I wondered if
> > anyone had any experience of this.
> > 
> > (For session persistence in approx - my cgi proxy)
> Just thought to add:
> 1. are you using a database for this? (you should be) Look at
>    BSDDBCookieJar.  BSDDBCookieJar isn't well-tested, but might be
>    just the ticket for what you're doing.  It's not in cookielib yet,
>    but the one from ClientCookie 0.9.x should work fine with
>    cookielib, and I'll make it available in a separate package RSN,
>    along with the other stuff in ClientCookie but not in cookielib.

The program I'm writing is a CGI. I'd like to have *minimum*
The version of Python on the server is 2.2 (I have no control over
that) and having a dependence on CookieClient is enough for me. I
think I can only use BSDDBCookieJar if the server has the Berkely
Database installed ? I'd like other people to be able to use my CGI on
a basic Python 2.2 install - so even if I have it on my server, I
don't want to be dependent on it.

What I'm aiming to provide is persistent cookie support for multiple
users of the same CGI - so I'll probably assign each user an id number
via a cookie I give to them and have a pickled CookieJar for each

I'd also like to work towards cookie management as well - so each user
can see/edit/control which cookies they have saved.

At the moment getting it to work at all would be a bonus........



> 2. here's a simpler way (in a sense) of serialising a CookieJar than
>    pickling:
> cj = cookielib.CookieJar()
> ...
> s = [repr(c) for c in cj]
>    and unserialising:
> cj = cookielib.CookieJar()
> for cs in s:
>     cj.set_cookie(eval(cs))
> ...
>    You'd still need to write something like BSDDBCookieJar, though, if
>    I understand what you're doing.
> John

More information about the Python-list mailing list