[Zope-dev] z3c.form - creating a file upload widget

Martin Aspeli optilude+lists at gmail.com
Thu Mar 12 23:51:02 EDT 2009


Stephan Richter wrote:
> On Thursday 12 March 2009, Martin Aspeli wrote:
>> Could I maybe create a custom validator that checks for a magic
>> constant? If so, how? I have both a custom field (in the zope.schema
>> sense) and a custom widget.
> 
> Yeah. I could swear I implemented this before. A validator is an adapter for 
> the field, widget and more, so creating a special one for your case is no 
> problem at all.
> 
> Actually, did you see the FileUploadDataConverter in converter.py? It does the 
> right thing when no new data was uploaded. It is registered for IBytes and 
> IFileWidget, so if you use a different field and widget interface, it would 
> not be used, but you could use it.

Yes - I have a custom converter based on this. However, it's based on 
the z3c.form 1.x one, I guess. The NOT_CHANGED constant doesn't exist in 
my version. :-/

Martin

-- 
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book



More information about the Zope-Dev mailing list