Cookies

Hans Nowak wurmy at earthlink.net
Wed Jan 9 11:09:46 EST 2002


QdlatY wrote:
> 
> Hello!
> 
> SmartCookie object does automatic serialization of non-strings types ?
> 
> I tried to use this in following way:
> 
> import Cookie
> 
> c = Cookie.SmartCookie()
> c["simple"] = [1, 2, 3, 4, [5, 6]]
> 
> and how do i now access to the "simple" list as list of course?

Never used this module before, but it seems you can use the
'value' attribute:

>>> import Cookie
>>> c = Cookie.SmartCookie()
>>> c["simple"] = [1, 2, 3, [4, 5]]
>>> c
<SmartCookie: simple=[1, 2, 3, [4, 5]]>
>>> c["simple"]
<Morsel: simple=[1, 2, 3, [4, 5]]>
>>> dir(c["simple"])
['coded_value', 'data', 'key', 'value']
>>> c["simple"].value
[1, 2, 3, [4, 5]]
>>> 

HTH,

--Hans (base64.decodestring('d3VybXlAZWFydGhsaW5rLm5ldA==') 
       # decode for email address ;-)
Site:: http://www.awaretek.com/nowak/



More information about the Python-list mailing list