Storing objects in dictionary

Feghhi, Jalil JFeghhi at visa.com
Thu Nov 4 21:59:03 CET 2004


I am actually trying to store a FieldStorage object (which contains values of a post) into the session for later use. Something like session['data'] = data. I don't have the error message right now but something like "object cannot be set". 

-Jalil

-----Original Message-----
From: python-list-bounces+jfeghhi=visa.com at python.org
[mailto:python-list-bounces+jfeghhi=visa.com at python.org]On Behalf Of
Jeremy Jones
Sent: Thursday, November 04, 2004 12:09 PM
To: Feghhi, Jalil
Cc: python-list at python.org
Subject: Re: Storing objects in dictionary


Feghhi, Jalil wrote:

>I get an error storing an object in a dictionary. The dictionary and the object are both provided by mod_python. One is the session object (which is just a dictionary) and one is a FieldStorage object (I think it is a class but displays as a dictionary). My question is what is the requirement for an object to be able to store it in a dictionary? I am sure there is documentaion somewehre but I couldn't find it.
>
>Regards,
>
>-Jalil
>  
>
Are you trying to use the session object as a key in the dictionary or a 
value of a key?  What error are you getting?  You should be able to put 
anything into a dictionary (AFAIK) as a key, but only hashable objects 
can be put in as keys.


Jeremy Jones
-- 
http://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list