[Zope3-dev] Changes to the schema package

Jim Fulton jim at zope.com
Tue Jan 6 07:24:03 EST 2004


Philipp von Weitershausen wrote:
> 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.

That's fine, however, if you don't specify a value type, you can't
get a widget for it.  You won't be able to generate a form that
has such a field.  Technically, the field type isn't necessary,
but, since most people expect to be able to get widgets, it's probably
an error if you don't have one.

> 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.

I'm confused. Which XXX are you refering to?

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org




More information about the Zope3-dev mailing list