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

Steve Alexander steve@z3u.com
Mon, 28 Jul 2003 11:18:36 +0300


Tres Seaver wrote:
> On Tue, 2003-07-22 at 10:40, Fred L. Drake, Jr. wrote:
> 
> 
>> > - Text fields have a missing_value of '' (empty string) instead of None.
>>
>>Argh.  I know there is a popular position that this is the right thing
>>to do, but it doesn't feel right to me.  Using None as the default
>>missing_value makes it easier to detect careless bugs.
> 
> 
> +1.  Enough time spent wrestling with Oracle's insistence that NULL and
> the empty string were identical makes me allergic to the use of a "real"
> domain value for the missing one.  Perhaps that same problem burned out
> others' sensitivities to the bogosity. :)

I've been thinking about this a bit, and Garrett's recent work has been 
illuminating :-)

I think a good approach for my typical use-case is to say that the field 
is required and can contain any string value, including the empty string.

The widget used to present the field is configured such that if there is 
no value filled in on the form, the empty string is used.

The difference is that the widget is responsible for the policy of what 
a missing value on the form is to be mapped to on the field. Often, 
we'll want the widget's to map a missing input to the field's 
missing_value. A common case with text fields is that the widget will 
map a missing input to the domain value of the empty string.

So, +1 from me to what Fred and Tres said. This is a change from my 
previously-held position. Thanks to Garrett for acting as a light-bulb :-)

--
Steve Alexander