[Zope] Custom Method to edit PythonScript

J Cameron Cooper jccooper at jcameroncooper.com
Mon Sep 15 22:28:44 EDT 2003


> I would like create a custom DTML-Method to edit a python-script 
> within Zope. The reason for this is that I would like to be able to 
> control in certain ways so I don't want to use 
> "ZPythonScriptHTML_editForm". The user must not be able to change the 
> whole script but only parts I let him see. Something like the 
> 'manage_edit' object of DTML-Methods is (more or less) what I need.
> The result would be a web-form that lets the user edit some parts of 
> the script body, the parameter and some aditional python code is added 
> by a script/method. (I hope this makes sense ...)
>
> I am trying understand how the "PythonScript.py" does things but do to 
> my limited knowledge (Zope-Newbie) I get stuck.
>
> My idea was to use the read() function to read the body into my custom 
> form an write it back with the write() function.
> But doing this I don't use the nifty code-checking feature which I 
> would like to use.

You don't have to submit a form directly to the Python Script method 
that changes things. Submit it to your own method, check, change, and 
correct as you will, and send this to the method that actually makes the 
change on the object.

I'm not sure about the read/write API you mention, since I haven't 
looked it up, but whatever the actual ZMI form submits to you can 
probably safely call too.

          --jcc

-- 
"My point and period will be throughly wrought,
Or well or ill, as this day's battle's fought."





More information about the Zope mailing list