On Tue, May 29, 2007, Bill Denney 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?
I *THINK* you can say this in current versions of sqlobject: d = someinstance.sqlmeta.asDict() Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 ``Rights'' is a fictional abstraction. No one has ``Rights'', neither machines nor flesh-and-blood. Persons... have opportunities, not rights, which they use or do not use. -- Lazarus Long ------------------------------------------------------------------------- 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 sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss