[ZPT] Reading a file

Larry Wright larrywright at gmail.com
Thu Aug 5 00:11:21 EDT 2004


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. In a
regular (non-Zope) python app, I would do this:

f = open("myfile.xml")
for line in f.readlines():
  print line # or whatever


This won't work in Zope. So, what is the proper way to do this?

Thanks,
Larry


More information about the ZPT mailing list