[SQLObject] Re: SQLObject inheritance patch 2
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: Oleg B. <ph...@ph...> - 2004-02-11 19:47:44
|
Hi!
I tried a simplest test.
import SQLObject
from db import db_conn
class Woman(SQLObject.SQLObject):
_inheritable = 1
_connection = db_conn
name = SQLObject.StringCol()
class Wilma(Woman):
smile = SQLObject.IntCol()
wilma = Wilma.new(name="Wilma", smile=1)
barney = Barney.new(passion=wilma)
woman = Woman(1)
print woman # prints <Wilma 1 childName=None smile=1>, ok
print woman.smile # => 1
print woman.name
Traceback (most recent call last):
File "test.py", line 10, in ?
print woman.name
File "<string>", line 1, in <lambda>
AttributeError: 'Wilma' object has no attribute '_parent'
Oops. I found many places in the code where _parent attribute is
used, but only one where it is assigned - in new(). Shouldn't it be
assigned in __new__ too?
Oleg.
--
Oleg Broytmann http://phd.pp.ru/ ph...@ph...
Programmers don't die, they just GOSUB without RETURN.
|