23 Jun
2005
23 Jun
'05
11:48 p.m.
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