Re: [SQLObject] Inheritance strangeness
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: Oleg B. <ph...@ph...> - 2005-06-03 14:50:58
|
On Fri, Jun 03, 2005 at 07:05:50PM +1000, ab...@ne... wrote:
> class Employee(Person):
> _connection = conn
> _inheritable = False # comment this line to solve bug OR
> #position = StringCol(default='Chief') # uncomment this line to solve bug
I've found the cause of the problem. Inheritance machinery does not
like classes that don't have attributes (beside obvious id). The
machinery needs to propagate columns from an every parent class to all
its children, but in a class with no attributes the code is not
triggered!
I'll look further if I can trigger the code somewhere else. Meanwhile
you've found two ways to overcome the problem. Either add a fake column
or a StringCol("childName") via setting _inheritable = True.
> in my situation not all
> my inherited classes define extra attributes (e.g. they instead have
> different behaviour etc.)
PS. I wonder how do they have different behavior without any
attributes? Via properties, I suppose?
Oleg.
--
Oleg Broytmann http://phd.pp.ru/ ph...@ph...
Programmers don't die, they just GOSUB without RETURN.
|