[Zope3-dev] Changes to the schema package
Philipp von Weitershausen
philipp at weitershausen.de
Mon Jan 5 10:51:06 EST 2004
Hey there,
a Happy New Year to everyone. Over the holidays, I have been digging
through the schema package and related packages (forms, etc.). Here are
a few points that I would like to get your comments on:
1. Sequence type fields (Sequence, List, Tuple, Tokens) take a
value_type argument, dictionary type fields (Dict) take a key_type and
value_type argument. Currently, anything is accepted for these
parameters, while what they really want is a Field instance. Therefore,
I propose that if value_type and key_type, respectively, do not
implement IField, a ValueError is raised.
Some XXX comments also say, that a value_type/key_type of None should
not be accepted, but I disagree. I can see that sometimes you do not
want the value or key of a sequence or dictionary to be of a special
type. That's when you pass None for value_type/key_type, so the value or
key will not be validated with a field.
2. Enumerated is a base class of many fields. XXX comments say that it
should go away, which makes a lot of sense, because enumerated fields of
that type can and should always be made separately. I propose to remove
Enumerated in all those places.
3. Currently, custom widgets are created using CustomWidget, which
really is a factory (it implements IViewFactory). IMO, it should be
renamed to CustomWidgetFactory to reflect its meaning better. A XXX
comment in the code is saying the same thing. Objections?
I'd appreciate feedback on these issues.
Philipp
More information about the Zope3-dev
mailing list