From: Oleg B. <ph...@ph...> - 2010-09-24 20:21:51
|
On Fri, Sep 24, 2010 at 01:11:13PM -0700, Octav Chipara wrote: > Thanks Oleg. BTW, is there an easy way to get attributes of an sqlobject by > their name? For example, if I have a person with attributes first_name and > last_name, however do i go around retrieving them. Could I do something like > Person.get_attr('first_name')? What is Person in your question - an SQLObject class (representing an entire SQL table) or an instance of such class (representing one row for the table)? If it's a class - you need to call Person.select() and loop over the result rows. If it's an instance - just get (or set) Person.first_name: print Person.first_name Person.first_name = 'Octav' Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |