[Zope] File I/O in Zope

Tino Wildenhain tino@wildenhain.de
Mon, 12 Nov 2001 20:07:00 +0100


Hi Chris,

first: please use only plain text for mailinglist. Most people
dont like html text there.

Zopes DTML and Python Script Objetcs are in a security sandbox
for good reason. (see the documentation for the reasons, they are
explained in great detail)
However, if you _really_ nead to access a file in the filesystem,
you have to use an external method. For security reasons dont
use the filename as a parameter for this function or only
after excessive testing of the name.

HTH
Tino Wildenhain

--On Monday, November 12, 2001 11:56:29 -0700 csnorville@fedex.com wrote:

>
> Hi Everyone,
>
> I am fairly new to Zope and I need some assitance on something that I
> know  is fundamental so please don't beat up on me too bad ;-)
>
> I am try to open a file with a Python Script in Zope for content
> manipulation. This  is a text file, I basically want to read a number,
> operate on it and write it back out.  However when I try to get my file
> handle I get;
>
> file=open("/home/chris/misernumber", "r+")
>
> Zope Error
>
>            Zope has encountered an error while publishing this resource.
>            Error Type: NameError
>            Error Value: global name 'open' is not defined
>
> I tried creating the file as a Zope object but I get the same error.
> Again I know this  is fundamental. If ya'll can help me with this, or at
> least point me to some documentation  it would be deeply appreciated.
>
> Thanks,
>
> Chris