Hi all, I want to define a set of sets of dependecies. That is I've a package that is related to a set of disjuncts, each of them composed by a set of elements. I've written a small example (below) but I keep getting AttributeError: 'Clause' object has no attribute 'addElement'
I don't understand why the dynamic method addElement is no added to the class Clause even if it declares a SQLMultipleJoin. Moreove I'm not sure about my solution, and in particular if sqlobject will generate two different relations for 'Depdend' and 'Suggest' that are both declared as SQLMultipleJoin ... thank you for your help :) p ps: is there a irc channel for sqlobject ? --------------------- cut here ------------- #!/usr/bin/python import os import sqlobject as sql class Element(sql.SQLObject): unit = sql.StringCol(notNone=True) version = sql.StringCol() clause = sql.ForeignKey('Clause') idxUnit = sql.DatabaseIndex('unit') class Clause(sql.SQLObject): disjuncts = sql.SQLMultipleJoin('Element',joinColumn='clause_id',addRemoveName='Element') class Package(sql.SQLObject): unit = sql.StringCol(notNone=True) version = sql.StringCol(notNone=True) depends = sql.SQLMultipleJoin('Clause',addRemoveName='Depend') suggest = sql.SQLMultipleJoin('Clause',addRemoveName='Suggest') def db_connect(): path = os.path.abspath('test.db') has_db = os.path.exists(path) if not has_db: if not os.path.exists(os.path.dirname(path)): os.makedirs(os.path.dirname(path)) uri = 'sqlite:' + path uri += '?debug=1' conn = sql.connectionForURI(uri) sql.sqlhub.processConnection = conn Clause.createTable() Element.createTable() Package.createTable() if __name__ == '__main__': db_connect() c = Clause() d = Element(unit='lalal',version='',clause=c) c.addElement(d) p = Package(unit='babal',version='1') p.addDepends(c) p.addSuggest(c) ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss