AW: AW: [Zope-dev] z3c.form: unicode error with upload form

Roger Ineichen dev at projekt01.ch
Fri Mar 7 21:18:24 EST 2008


Hi Christophe

> Betreff: Re: AW: [Zope-dev] z3c.form: unicode error with upload form

[...]

> > I guess I know what you are trying to do.
> > As I implemented this widget I was thinking that a file 
> upload never 
> > get used for representation. Becaues it allways offers only upload 
> > again if already an uploaded file exists.
> 
> I've just an image object, that I want to upload:
> 
> class ThumbnailImageEdit(EditForm):
>      fields = Fields(IImage).select('data')
> (...)
> 
> So it wants to display the 'data' field, and fails. Actually 
> not displaying anything is a reasonable default option but it 
> should not fail. This really should be as simple as the 
> formlib for such simple cases, without having to select a 
> particular widget. An advanced default option would be to 
> display the image beside the upload field, but it may be 
> difficult to find a decent layout.
> 
> Christophe

I think the problem is more deep in the implementation.
If we use a binary field we will get a generic upload 
implementation. What I think is the right way to do is
to implement a IImage or ITextFile field. Such fields
whould allow us to implement the correct widget, converter 
and validators.

If you need to allow upload any type of file, some 
generic mime type sniffer and probably a special converter
is needed.

Do you have an idea how such a generic widget should work?
Probably the concept offered in z3c.filetype could be usefull
for a better solution. Any hints are welcome!


Regards
Roger Ineichen
_____________________________
END OF MESSAGE



More information about the Zope-Dev mailing list