I haven't had a chance to look at MultipleJoin closely, to really figure
out what it's problem is, but I did (rather blindly) apply a patch sent
by Cyril. It's not in 0.6, but it's in the repository, maybe it will
help you.
David M. Cook wrote:
> I like to give my MultipleJoin columns the name 'children' to give a uniform
> way to access the associated objects. But SQLObject 0.6 ignores my class
> attribute name:
>
> from sqlobject import *
>
> __connection__ = 'sqlite:///tmp/test.db'
>
> class Composer(SQLObject):
>
> name = StringCol()
> children = MultipleJoin('Work')
>
> class Work(SQLObject):
>
> composer = ForeignKey('Composer')
> title = StringCol()
>
> for klass in Composer, Work:
> klass.dropTable(ifExists=True)
> klass.createTable(ifNotExists=True)
>
> c = Composer(name='Beethoven, Ludwig van')
> w = Work(composer=c, title='Symphony No. 7')
>
> print c.works
> print c.children
>
> This gives the result:
>
> [<Work 1 composerID=1 title='Symphony No. 7'>]
> Traceback (most recent call last):
> File "<stdin>", line 23, in ?
> AttributeError: 'Composer' object has no attribute 'children'
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
> Project Admins to receive an Apple iPod Mini FREE for your judgement on
> who ports your project to Linux PPC the best. Sponsored by IBM.
> Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
> _______________________________________________
> sqlobject-discuss mailing list
> sql...@li...
> https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
--
Ian Bicking / ia...@co... / http://blog.ianbicking.org
|