Re: [SQLObject] Iterating through a record...
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Leandro L. <ll...@gm...> - 2008-02-28 12:54:17
|
Oleg Broytmann, el 28 de febrero a las 10:32 me escribiste: > On Thu, Feb 28, 2008 at 02:57:50AM -0200, Sam's Lists wrote: > > I can print the record find by coercing it into a string. > > > > But I'd like to be able to iterate through it myself. And I can't. I keep > > getting: 'TypeError: 'TheRun' object is not iterable' > > > > Why is this the case? > > Why do you expect a record to be iterable? There is a list of column > names, but there is no a list of values, you have to get a value for > a column by the column's name. Well, there is a sqlmeta asDict() method that returns a dict, so you can do: for v in obj.sqlmeta.asDict(): # ... If that's useful. -- Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/ ---------------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------------- Just because you're paranoid, don't mean they're not after you. |