[Zope3-dev] quoting cookies
Tres Seaver
tseaver@zope.com
20 Feb 2003 09:26:28 -0500
On Thu, 2003-02-20 at 08:15, Steve Alexander wrote:
> Steve Alexander wrote:
> > zope/publisher/http.py, line 823.
> >
> > Cookie values and comments are not quoted at all by the HTTP response
> >
> > Some applications will want to take care of quoting values in cookies,
> > but most applications will want to be able to set cookies and get
> > cookies, and have sensible quoting take place automatically.
> >
> > Any thoughts?
>
> One thought is to make setCookie quote the value by default, unless a
> do_not_quote=True (or perhaps raw=True) argument is passed in.
>
> I think people don't care about the exact representation of cookies most
> of the time.
class IHTTPCookieQuoter(Interface):
def quoteCookie(mapping):
""" mapping->string.
o Applies appropriate quoting.
"""
Then, in ZCML:
<utility component=".utilities.cookie_quoter"
provides=".IHTTPCookieConverter"
/>
People who want to change the policy then do it via configuration,
rather than code.
Tres.
--
===============================================================
Tres Seaver tseaver@zope.com
Zope Corporation "Zope Dealers" http://www.zope.com