Ferhat Ayaz wrote at 2006-9-7 01:20 -0700:
> ...
>I want to read a File object from ZODB. How can I read
>the content of the uploaded File object?

Reading a "File" object from ZODB is *VERY* different from
reading a "ZPublisher.HTTPRequest.FileUpload" object.

A "File" object has its data in an attribute named "data".
If the "File" is larger, then "data" is not a string but a
complex data structure (a linked list of "pdata" objects).
You can use "str(File.data)" to get the complete content.

A "FileUpload" object on the other hand behaves very much
like a Python "file" object. Especially, you can use "read",
"tell", "seek", ...

>I must to read it line by line with readlines()

For "FileUpload", readline will probably work too. But I am not
sure. Try it out...

Zope maillist  -  Zope@zope.org
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to