[Zope3-dev] haveValue and widgets

Garrett Smith garrett@mojave-corp.com
Wed, 16 Jul 2003 11:54:05 -0500


Now that we have a format notion of 'missing' for both widgets and
fields, I think the implementation of 'haveData' needs to be changed.

It is currently implemented to return False when the form contains data
but the data equals the widget's _missing value. E.g. a form is
submitted containing a empty text field, the widget will return False
for haveData.

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.

I'm proposing that the default implementation of BrowserWidget's
haveData is:

    def haveData(self):
        return self.name in self.request.form

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

 -- Garrett