[Zope] cookie problem

Evan Simpson evan@4-am.com
Mon, 31 Jan 2000 13:41:21 -0600


Hung Jung Lu wrote:

> Hmm... are you sure base64 is good enough? I was using
> base64's encoding, but then I was still running into
> problems. I don't remember the exact situation,
> but base64 was not good enough.

Indeed.  base64 can produce '='s, which cookies don't like one bit.

> At the end, I had to switch to urllib, by using
> urllib.quote_plus() and urllib.unquote_plus().

A good solution.  The ideal, of course, would be to change RESPONSE.setCookie
so that it automatically applies 'cookie_quote' to cookie values, and have
ZPublisher 'cookie_unquote' the cookie dict.  The implementation of these two
methods is left as an exercise for the reader.

Cheers,

Evan @ 4-am (and soon digicool)