[Modeling-users] Many-to-many relationship example doesn't work?
Status: Abandoned
Brought to you by:
sbigaret
From: <co...@sa...> - 2004-08-10 12:54:35
|
Hello, First of all thanks to Sabastien for his efforts creating this framework. Projects I'm involved now requires lots of Many-To-Many relations in E-R model, so I've tried adding methods (for tranparent access to correlation entity) as described in the example in UsersGuide 2.6.3. But those methods doesn't work. So I've copy-pasted example from user's guide, but it did'nt work as well.: i.e I add methods getAddresses(), addToAddresses() to the class "Person", Then I try to run a code, that uses those classes: ------------- #test.py from Modeling.EditingContext import EditingContext from MM1 import Person, Address ec=EditingContext() p = Person.Person() a = Address.Address() p.addToAddresses(a) ec.insert(p) ec.insert(a) ec.saveChanges() ----------------- I get an error: Traceback (most recent call last): File "./test.py", line 8, in ? p.addToAddresses(a) File "/tmp/test2/MM1/Person.py", line 76, in addToAddresses self.editingContext().insert(_pa) AttributeError: 'NoneType' object has no attribute 'insert' ----------------- I've looked into CustomObject.py, and i could'nt find any assigment of REAL editing, context, only initial definition 'lambda self: None' Did i misunderstood something, or this example code in User's guide is just out-dated? Can someone please give me some guidlines? I'm using: Python 2.3, Modeling: 0.9-pre-17.1 |