[Zope] Reading lines from a Zope File object
J Cameron Cooper
zope-l at jcameroncooper.com
Thu Jun 23 19:48:05 EDT 2005
Andy McKay wrote:
> J Cameron Cooper wrote:
>
>> You can get the main contents of a File with the 'data' attribute. It
>> returns a string.
>
> I think it actually returns an object (for large file support), if you
> want the data as a string you need to string it.
>
> So for small files:
>
> datastr = str(context.fileObject.data)
>
> Should work.
Yes, forgot that caveat. For large files, 'data' can return a "Pdata", a
list of strings. For small files, it returns a string. Always doing
'str' is a good idea.
--jcc
--
"Building Websites with Plone"
http://plonebook.packtpub.com/
Enfold Systems, LLC
http://www.enfoldsystems.com
More information about the Zope
mailing list