[Zope3-dev] haveValue and widgets

Fred L. Drake, Jr. fred@zope.com
Wed, 16 Jul 2003 13:54:45 -0400


Garrett Smith writes:
 > But this is wrong since an empty text field is meaningul user submission
 > -- the widget does contain data which should be translated to a
 > field.missing_value.

If that's what makes sense for the widget.  That's usually OK for the
standard HTML form fields.

 > I'm proposing that the default implementation of BrowserWidget's
 > haveData is:
 > 
 >     def haveData(self):
 >         return self.name in self.request.form

If is probably the most reasonable default behavior.  Complex widgets
that need to check a variety of form fields will have to override this
anyway.

 > Btw, is there some reason it's 'haveData' and not 'hasData'?

Tres Seaver writes:
 > Heh, because somebody pedantically insistes that 'data' is the plural of
 > 'datum', but then commits the solecism of agreeing the verb with the
 > object instead of the subject. ;)

An excellent explanation!  Made me use my dictionary (www.dict.org).


  -Fred

-- 
Fred L. Drake, Jr.  <fred at zope.com>
PythonLabs at Zope Corporation