[Zope] How do I utilize manage_edit in a stand alone form?
J Cameron Cooper
Thu, 05 Jun 2003 12:45:37 -0500
>What I was trying to do was create a stand alone form to
>edit a DTML document. I am just about to wrap up an
>extranet that Administrative assistants use to mange group
>of files and had only one file that needed to be edited and
>I don;t want them to have access to ZMI.
>What isn't working is that once I make change to the text
>displayed in the text area box and hit submit that nothing
>is refreshed with the old data stored in the file and it is
>I set up the DTML method that way because it was something
>I had done with a different method and thought I could get
>away with in again.
>I am looking into trace back now.
A few things to keep in mind:
When you say <dtml-var file1> you are getting the rendered version of
the file. This will never work for editing it. You need to get the DTML
source. What the ZMI does to render its management page is to use a DTML
method that is called on the object and uses __str__ to get the source.
There are other avenues: check your source/API. (Hint: document_src)
Be careful about giving non-developer users access to executable
objects' source (which includes DTML.) It's generally hard to break
things or damage the system with DTML given the right permissions, but
it's better to be totally safe. I would use something like
StructuredDocument or simply a File with structured text in it that gets
rendered: check ZopeLabs on how to do this.
Once you fix your call to manage_edit, the changes should be made. You
should probably return the rendered view of wherever you want to go
(probably the edit form again) from your script rather than redirecting.
Make sure that you give any error messages to the editor: otherwise,
you're sure to have things "mysteriously break." Check out how the ZMI