[ZPT] Reading a file

Evan Simpson evan at 4-am.com
Thu Aug 5 01:27:21 EDT 2004


Larry Wright wrote:
> Ok, this is slightly off topic. I'm doing a prototype of an
> application, and as part of this I want to read data from a 
> "database" - right now an xml file.  Obviously in a real application I
> would use MySQL or something, but for right now I just want to use
> this xml file. So, I have created a file object in a zope folder, and
> I filled it with some xml data. I want to read the data from this file
> in a python script and return it to be processed by a zpt.

Convert the file object into a string, something like this:

return str(getattr(container, 'myfile.xml'))

Cheers,

Evan @ 4-am


More information about the ZPT mailing list