|
From: MJR <py...@ce...> - 2004-08-30 10:30:25
|
Any idea why the one-to-many example from SQLObject documentation works with
addresses=MultipleJoin('Address'), but doesn't with
addr=MultipleJoin('Address').
I am using a version from SVN.
tx,
mike
+++++++++++++++++++++++++++++++++++++++++++++++++++
Traceback (most recent call last):
File "C:\wroot\mps\tracker\test.py", line 26, in ?
print p.addr
AttributeError: 'Person' object has no attribute 'addr'
+++++++++++++++++++++++++++++++++++++++++++++++++++
from sqlobject import *
__connection__ = 'mysql://test@localhost/test'
class Person(SQLObject):
firstName = StringCol()
middleInitial = StringCol(length=1, default=None)
lastName = StringCol()
addr = MultipleJoin('Address')
class Address(SQLObject):
street = StringCol()
city = StringCol()
state = StringCol(length=2)
zip = StringCol(length=9)
person = ForeignKey('Person')
def reset():
Person.dropTable(ifExists=True)
Person.createTable()
Address.dropTable(ifExists=True)
Address.createTable()
reset()
p = Person(firstName='John', lastName='Doe')
print p.addr
a1 = Address(street='123', city='Smallsville', state='IL', zip='50484',
person=p)
print [a.street for a in p.addr]
+++++++++++++++++++++++++++++++++++++++++++++++++++
|