[Zope3-dev] Re: [Zope3-checkins] CVS: Zope3/src/zope/schema -_bootstrapfields.py:1.19.2.1

Shane Hathaway shane@zope.com
Mon, 28 Jul 2003 13:46:53 -0400


Garrett Smith wrote:
> Here are some thoughts...not sure if any of this is in contention, but
> maybe it will help to identify points of agreement/disagreement.

I agree with all of this, with minor exceptions.

> Starting with fields-in-general, are we still in agreement that Zope 3's
> fields support 'missing values'? So far, I think what we have works very
> well: a field must define a missing value, but if it is 'required', that
> missing value cannot be legally assigned. I.e. the notion of 'missing
> value' is not meaningful for required fields.

So widgets internally use some notion of "no input", which they 
translate into:

- for non-required fields, a missing value.

- for required fields, a validation error.

This makes sense.  However, there's this weird case where a text widget 
representing a non-required text field needs to interpret "no input" as 
an empty string value, rather than a missing value.  I don't understand 
why this odd case doesn't seem to occur with other widgets, but it's not 
specific to browsers.

> - The text widget, when rendering as a textbox, *cannot* support a
> 'missing value' since there's no way for a user to say 'I don't know
> what the value is'.

However, a text widget representing a required text field supports the 
notion of "no input" and will generate a validation error if the widget 
is left empty.

> - The text widget, when rendering as a dropdown (because it has a list
> of allowed values), *can* support a missing value by adding an
> additional option that lets the user say 'dunno'. Currently, this option
> is rendered as a blank entry in the list (not very clear, but still
> available).

YAGNI. ;-)

> - Fields should support crazy missing values like an empty string. The
> only condition is that the missing value cannot also be a legal value.
> E.g. a text field that defines missing_value as '' should also have a
> constraint min_length > 0.

That's a useful constraint.

Shane