[Zope3-dev] Important IFile bug!

Jim Fulton jim at zope.com
Fri Jan 14 11:51:06 EST 2005


Janko Hauser wrote:
> 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?

I don't know what you mean.  By suggesting an IMime interface,
I meant to suggest that there was a mime object.

> 
> 
>>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?

Only if you use a memory-based session storage, which I would
not do.

> 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.

Yay! :)

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the Zope3-dev mailing list