[Zope] Re: Read the contents of a File object

Oliver Bleutgen myzope@gmx.net
Tue, 27 May 2003 17:52:49 +0200


THerp@apriori.de wrote:
> Hi, everyone,
> 
> 
>>I'd like to read lines from a File object to do a database import.
> 
> 
> After a lot of struggling (trying index_html and document_src and...) and
> finally posting the question I managed myself meanwhile: The data attribute
> of the file object gives me its content.

You may run into trouble if your file is too big, because then data is 
not what you expect it to be (it may be practically a linked list of 
data chunks, for performance reasons).

Use str(file.data) or str(file) to be on the save side.


cheers,
oliver