[Zope3-dev] Is there a convenient way to handle object references?
Adam Groszer
adamg at fw.hu
Mon Jul 11 05:56:00 EDT 2005
Dear All,
I'm looking for an easy way to handle object references with Z3 with
schema and widgets.
The UML diagram is rather simple for example:
+--------------+ +-------------+
| <<entity>> | unit | <<entity>> |
| Unit | <------------- | Item |
+--------------+ +-------------+
| +unit:string | | +code:string|
+--------------+ | +name:string|
| +cost:int |
+-------------+
More complex classes are to come of course. The Unit objects are
modifiable by the user, they cannot be hard-coded.
I would write the interfaces like this:
class IUnit(Interface):
"""Unit, measurement unit"""
unit = TextLine(title=u"Unit",description=u"Unit",required = True)
class IItem(Interface):
"""Item, that can be stored in the warehouse"""
code = TextLine(title=u"Code",description=u"code",required = True)
name = TextLine(title=u"Name",description=u"name",required = True)
cost = Int(title=u"Cost",description=u"Cost",required = False)
unit = Object(title=u"Unit",description=u"the item is measured with this",
schema=IUnit, required = True)
I'm not 100% sure, that Object() is the right one for that. For the
current situation maybe it's OK, for many-to-many and complicated
references I think schoolbell.relationship should be better for that.
class IUnitContainer(IContainer):
"""Unit Container"""
contains(IUnit)
class ISubitemContainer(IContainer):
"""Subitem Container"""
contains(ISubitem)
Now a widget would be nice, which allows to select a unit from the
UnitContainer with a combobox or something.
The current ObjectWidget seems like a kind of in-place input of the properties
of the schema. I'm not sure that I got it 100%.
Any hint, sample, pointing out a product to check is appreciated.
--
Best regards,
Groszer Adam
More information about the Zope3-dev
mailing list