[Zope3-Users] Re: how to model a 1-to-1 relation
john saponara wrote: I want to allow the user to create car and driver objects in a limoService container. Car objects will stand alone, but each driver object should contain a car object by reference (not by value) and the driver add form should allow the user to choose which car the new driver object will have. Should IDriver's car attribute be a schema.Object or a schema.Choice? Have a look at the package zc.relation and for a simple use of zc.relation use lovely.relation which provides relation properties for your objects. Jürgen ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: how to model a 1-to-1 relation
Jürgen Kartnaller a écrit : john saponara wrote: I want to allow the user to create car and driver objects in a limoService container. Car objects will stand alone, but each driver object should contain a car object by reference (not by value) and the driver add form should allow the user to choose which car the new driver object will have. Should IDriver's car attribute be a schema.Object or a schema.Choice? Have a look at the package zc.relation and for a simple use of zc.relation use lovely.relation which provides relation properties for your objects. What is zc.relation compared to zc.relationship? Jürgen ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] how to model a 1-to-1 relation
Am Donnerstag, 10. Januar 2008 23:00 schrieb john saponara: I want to allow the user to create car and driver objects in a limoService container. Car objects will stand alone, but each driver object should contain a car object by reference (not by value) and the driver add form should allow the user to choose which car the new driver object will have. Should IDriver's car attribute be a schema.Object or a schema.Choice? That's an interesting question, as I currently have a similar problem. It seems that if you store one object mulitple times in the ZODB, it does not duplicated it but stores only references. I tested that, however, I'm unsure if ZODB can really handle this in all situations. If this proves to work, things are quite easy, as one can do things like that: class Driver(BTreeContainer): A BTreeContainer for Drivers # A car is owned by two drivers: driver1 = Driver() driver2 = Driver() mycar = Car() driver1['mycar'] = mycar driver2['mycar'] = mycar Another issue I still have to sort out are permissions for this case, e.g. driver1 and driver2 may set attributes, but driver3 who does not own the car, may not. One way would perhaps be to permit a driver modification of all objects in his driver-container. Best Regards, Hermann -- [EMAIL PROTECTED] GPG key ID: 299893C7 (on keyservers) FP: 0124 2584 8809 EF2A DBF9 4902 64B4 D16B 2998 93C7 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: how to model a 1-to-1 relation
Christophe Combelles wrote: Jürgen Kartnaller a écrit : john saponara wrote: I want to allow the user to create car and driver objects in a limoService container. Car objects will stand alone, but each driver object should contain a car object by reference (not by value) and the driver add form should allow the user to choose which car the new driver object will have. Should IDriver's car attribute be a schema.Object or a schema.Choice? Have a look at the package zc.relation and for a simple use of zc.relation use lovely.relation which provides relation properties for your objects. What is zc.relation compared to zc.relationship? Of course I meant zc.relationship ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: how to model a 1-to-1 relation
On Jan 11, 2008, at 10:25 AM, Christophe Combelles wrote: Jürgen Kartnaller a écrit : john saponara wrote: I want to allow the user to create car and driver objects in a limoService container. Car objects will stand alone, but each driver object should contain a car object by reference (not by value) and the driver add form should allow the user to choose which car the new driver object will have. Should IDriver's car attribute be a schema.Object or a schema.Choice? Have a look at the package zc.relation and for a simple use of zc.relation use lovely.relation which provides relation properties for your objects. What is zc.relation compared to zc.relationship? zc.relation is zc.relationship NG. I have not released it yet. When I do, I'll also release a zc.relationship that is a wrapper of zc.relation. zc.relation has MUCH fewer dependencies, so it is more of a ZODB tool rather than a Zope tool; doesn't have the more user-friendly bits like the relationship container; and has some new features like transitive indexes that you can hook up. I have not released it because there a few features I want to test better (the new ``copy`` method in particular) and because I have been busy with other things. Gary___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users