On Thu, Jul 12, 2007 at 11:47:33AM +0100, Nick Murdoch wrote:
> class Line(SQLObject):
> owner = ForeignKey('Scene')
> text = UnicodeCol()
> prev = SingleJoin('Line', addRemoveName='Prev')
> next = SingleJoin('Line', addRemoveName='Next')
> created = DateTimeCol(default=datetime.now)
>
> >>> line1 = Line(owner=scene, text="moo")
> >>> line2 = Line(owner=scene, text="moo2")
> >>> line1.addNext(line2)
> Traceback (most recent call last):
> File "<console>", line 1, in ?
> AttributeError: 'Line' object has no attribute 'addNext'
Only RelatedJoin can do add/remove and use addRemoveName. SingleJoin
cannot add objects. And BTW where are backreferences (ForeignKeys) for
every SingleJoin?
What you probably want is the following:
class Line(SQLObject):
owner = ForeignKey('Scene')
text = UnicodeCol()
prev = ForeignKey('Line', default=None)
next = ForeignKey('Line', default=None)
created = DateTimeCol(default=datetime.now)
line1.next = line2
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 DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss