[Zope3-Users] Specifying object attributes at runtime from a
selection of schemas.
Alec Munro
alecmunro at gmail.com
Tue Jan 24 12:36:37 EST 2006
Hi List,
As part of an e-commerce system I am building, I need a way to specify
a set of schemas that the purchaser must fill in data for. For
example, in order to purchase product A, you need to select a paint
colour, but in order to purchase product B, you must select 3 paint
colours. I need a way for the site manager to specify this when adding
products to the site.
Currently, my plan for dealing with this is that I give all products a
"product_attribute" property, which consists of a list of schemas.
There are two relatively minor problems I have with this system:
In order to get the schemas, I currently have them all subclassing
IProductAttributes, and I look up the Interfaces vocabulary and parse
it for descendants of IProductAttributes. I would like a simpler way
to get them. One idea I had was creating my own Type, and declaring
them all to be of that type. Unfortunately, I don't know how to get a
list of all interfaces of a given type.
The second problem I have is that the built-in widget for a List of
Choices only allows you to select a single instance of each option
available to the Choice. Is this inherent to the Choice field itself,
or is it merely a limitation of the widget?
Any advice on either of these problems, or any suggestions on a
simpler way to accomplish the overall goal, would be very appreciated.
Thanks,
Alec Munro
More information about the Zope3-users
mailing list