Hi there,

I just saw this being changed in the wiki (by Fred Drake):

  the new zope.formlib. - -- Reimplement file objects (for
  Zope 2 or Zope 3 to take advantage of the new 'zope.formlib'

I'm curious to hear what this is about. I've been dealing with file widgets in particular a lot recently and have some input on it:

File widgets as in Zope 3 don't behave like text widgets. Basically they don't behave like any other widgets at all; they're an odd duck out. This is bad, because:

- for an add form, if something goes wrong and the form is redisplayed with some validation errors, the uploaded file information is lost. This is bad because for a required file field, it requires multiple uploads where one should suffice, and for a non-required file field, it's even worse, as a user would have no motivation to re-upload the same file after validation failure and redisplay of the form, resulting in no file being uploaded at all.

- for an edit form, there is no resubmit of the same data as you'd see with a text widget where the data hasn't been changed by the user. Instead there's either no upload, or an upload of a new file. This behavior is again different than a text widget, which makes programming harder as the programmer will have to check 'is there a file already there?' manually in some cases.

I've already solved the validation feedback form problem by storing files in a session temporarily. This isn't efficient, but I *also* developed something that will lick that problem and that I'll present in a lightning talk at the Plone conference.

I'm working on solving the second problem, so that a file is *always* present in the validated form data no matter whether it only ever resided on the server in case of an edit form. Basically I emulate the behavior of the text widget, for the file widget. This way they become a lot easier to work with.

I'll happily share all that I have, and this mail is just to prevent work is inadvertently duplicated. Probably you meant to work on something else, but I figured I'd make sure.


Zope3-dev mailing list
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to