On Tue, Jul 22, 2008 at 08:48:46PM +0200, Luis Javier Peris wrote:
> When I do a select to a class hierarchy I obviously get a specific
> child-herarchy object. I would like to know what type of child is, I
> wouldn't want to use the *isinstance* method of python and I'm wondering how
> can I get the value of childName column that is specified in the father
> class.

class Test1(InheritableSQLObject):
   name1 = StringCol(default=None)

class Test2(Test1):
   name2 = StringCol(default=None)

Test1.createTable()
Test2.createTable()

t1 = Test1(name1='test1')
t2 = Test2(name2='test2')

print t2._parent.childName # prints 'Test2'

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            [EMAIL PROTECTED]
           Programmers don't die, they just GOSUB without RETURN.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to