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

Garrett Smith garrett@mojave-corp.com
Tue, 22 Jul 2003 11:28:15 -0500


Fred L. Drake, Jr. wrote:
> -_bootstrapfields.py:1.19.2.1

>  > setData is called judiciously to avoid overwriting values from the
>  form. > But, as Fred mentioned, setData should probably not override
>  form values > anyway.
>=20
> No, what I meant was: setData() *must* not override form values even
> now.  The IWidget interface documentation is very misleading on this,
> and doesn't explain things in a world where "partial submits" are
> possible or even common.  (BTW, I hate the term "partial submit"; not
> sure who coined that.  It's a real HTML form submit!)

That's what I mean too.

I don't really like the fact that browser widgets read directly from the
form. I'd rather something configure the widgets explicitly with calls
like:

  setUserInput(value)

Here, perhaps, we could state that passing a None value to this method
indicates that there 'is no user input'. And

  getUserInput() is None

indicates the same.

I realize these are *browser* widgets and it's not bad to know about
HTTP forms, etc. But having an interface like this makes things a bit
more explicit, and lets folks like Steve use alternative input if they
want to.

Personally, I would be inclined to move these methods into IWidget...at
least getUserInput.

I also don't like the fact that widget has getValue and getData -- these
are too similar and give no hint as to how they're different. I'd prefer
something like:

  getFieldValue and setFieldValue

  getWidgetAttr and setWidgetAttr

Just some thoughts.

 -- Garrett