[Zope3-dev] Important IFile bug!

Roger Ineichen dev at projekt01.ch
Fri Jan 14 12:39:08 EST 2005


> Behalf Of Janko Hauser
> Sent: Friday, January 14, 2005 5:41 PM
> To: zope3-dev at zope.org
> Subject: Re: [Zope3-dev] Important IFile bug!
> 
> Jim Fulton schrieb:
> > Roger Ineichen wrote:
> >
> > ...
> >
> >
> >>Ok, what can I do?
> >>
> >>Should I implement a IData field and enhance this field?
> >
> >
> > I think you should define an IMime schema that defines methods
> > to get and set the data. I suggest that this should be a
> > file-like interface, with, at least, read and write.
> > It should have a mime-type attribute and an encoding
> > attribute, for use with text.
> >
> > Then you should define a mine field (IMImeField/MimeField)
> > for data with this interface.
> >
> In a former discussion there seemed to be the conclusion that 
> the field
> should actually be an object, which keeps the additional metadata. Has
> this been dropped?
> 
> > Finally, you need a widget.
> >
> > The widget should support:
> >
> > - file-upload
> >
> > - text area if content type is text/* *and* if an encoding
> >    is specified.
> >
> > - entry of content type and, for text types, the encoding
> >
> >
> >>The validate method of this field should allowes to store
> >>String and FileChunk? Others?
> >
> >
> > The validate method should accept strings and objects
> > with read methods.
> >
> >
> >>Is there a python lib for reading files and find the
> >>content type like stefan was implementing for images?
> >
> >
> > Of course, in the unlikely event that the client sends the
> > file type and/or encoding with the file upload, you should
> > use that information.  Otherwise, use zope.app.content_types,
> > which seems to use the Python mimetypes module.
> >
> > If you feel especially inspired, it would be nice to store
> > file-upload data in a session if someone submits a form
> > with a file-upload using other than the main submit
> > button or if there are validation errors on other fields.
> > IOW, it would be cool if the widget stored the data in a
> > session so that the data wasn't lost on a redisplay.
> >
> 
> Wouldn't this circumvent the memory savings we gain through the
> chunked upload?
> 
> Roger I would be interested to work with you on this. I have already
> made a crude FileField with widget, but not in the context of zope3
> but Five. There I store the data as a Zope2 File object.
> 
> With regards,
> 
> __Janko

That whould be great.

Can you add a branch, then we can commit on the branch
before we merge it to the trunk.

You can upload the Zope2 widget and field part somewhere
in zope.app.file if you like.

I can take a look at the in a couple hours. 

Regards 
Roger





More information about the Zope3-dev mailing list