Hi list,

  I have a class named Container. One Container may have one or more
containers determining a auto-relationship (one-to-many). I'm doing
this like this:

class Container(InheritableSQLObject):

    title = StringCol()
    container = ForeignKey('Container')
    containers = MultipleJoin('Container')

    def __init__(self, *args, **kwargs):
        SQLObject.__init__(self, *args, **kwargs)
        Container.sqlmeta.addJoin(MultipleJoin('Container',
joinMethodName='containers'))

But when I do:

1:    container1 = Container(title="the title")
2:    container2 = Container(title="the title")
3:
4:    container1.addContainer(container2)

I got the following error at line 1:

    raise TypeError, "%s() did not get expected keyword argument %s" %
(self.__class__.__name__, col.name)
TypeError: Container() did not get expected keyword argument containerID

Does someone can help or tell me the right way to implement an
auto-relationship?

Thank you,

Leandro.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to