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:
""" 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.
GPG key ID: 299893C7 (on keyservers)
FP: 0124 2584 8809 EF2A DBF9 4902 64B4 D16B 2998 93C7
Zope3-users mailing list