Loading a Cookie from a Dictionary

Michael Sampson samp0082_at_umn_dot_edu
Sun Feb 1 23:10:48 EST 2004


"John J. Lee" <jjl at pobox.com> wrote in message
news:87wu76ic6x.fsf at pobox.com...
> "Michael Sampson" <samp0082_at_umn_dot_edu> writes:
>
> > I'm using the Cookie module.
> > Say I have something that looks like this
> >
> > import Cookie
> > c = Cookie.Cookie()
> > c.load(aDictonary)
> >
> > What would the format of aDictornary be, I've looked around the net and
I
> > can only find examples on how to format the input to load if it is a
string.
> > The best info on this I could find is
> [...]
>
> What are you actually trying to accomplish?
>
> Server?  Client?
>
>
> John


Assume I have a server trying to create a cookie to send to the browser.
Instead of making the cookies one at a time like

c = Cookie.Cookie()

c['firstname'] = 'joe'

c['lastname'] = 'samson'

c['lastname'][max-age] = 3600

I want to be able to store the info for the cookies in one dictonary and
pass that to the constructor for Cookie(), or load it into the cookie using
c.load().





More information about the Python-list mailing list