On 5/29/07, Bill Denney <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm wanting to get an object as a dict similar to:
>
> # make it possible to return everything as its dictionary form
> def asDict(self):
> """Return an object as its dictionary form."""
>
> retval = {}
> for c in self.columns:
> retval[c] = self.__getattribute__(c)
>
> return retval
>
> SQLObject.asDict = asDict
>
> Unfortunately, to do this, I had to manually add the column names in
> each table. Is there a way to get the column names out, or
> alternatively, is there an existent method that will return the object
> as a dict?
>
> Thanks,
>
> Bill
>
>
Check the function named so_to_dict in
http://svn.turbogears.org/trunk/turbogears/database.py
I think it does what you need. Good luck!
--
Claudio
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss