[Zope] python script trouble?

Stefan H. Holek stefan at epy.co.at
Wed Nov 12 09:35:24 EST 2003


Kate!

Please be aware that there are a lot of things you are not allowed to do 
from PythonScripts for security reasons, opening disk files being one of 
them.

I suggest to create an External Method for this. More info is available 
here:

<http://zope.org/Documentation/Books/ZopeBook/2_6Edition/ScriptingZope.stx>

Stefan


--On Mittwoch, 12. November 2003 09:20 -0500 Kate Legere <klegere at kfpl.ca> 
wrote:

> I am calling a python script 'addToFile' from a dtml method:
> <dtml-call expr="addToFile()">
>
> the script is meant to open a pre-existing file and write to it:
>
>    f=open('file1', 'wt',1)
>    f.write('hello')
>    f.close
>
> At the moment I am just writing a test to see if it works and, it doesn't.
> I get, when I view the calling dtml method,
>
>     Error Type: NameError
>     Error Value: global name 'open' is not defined
>
> I have looked through the Python bible and am at a loss to think where I
> have erred.
>
> Kate
>
>
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )



--
The time has come to start talking about whether the emperor is as well
dressed as we are supposed to think he is.               /Pete McBreen/



More information about the Zope mailing list