[ZPT] Reading a file

Larry Wright larrywright at gmail.com
Thu Aug 5 08:07:01 EDT 2004


Hmm, but then what? I tried doing a typical open('filename'), but it
complained about there being no definition of the method 'open'. What
bit o f magic am I missing to make that work?

Thanks,
Larry

On Thu, 05 Aug 2004 00:27:21 -0500, Evan Simpson <evan at 4-am.com> wrote:
> 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