[Zope] Q: Using WebDav to edit Zope DTML Methods. SOLVED!

Graham Heyes heyes@jlab.org
Tue, 30 May 2000 15:13:02 -0400


Martijn Pieters wrote:
> 
> On Tue, May 30, 2000 at 02:30:47PM -0400, Graham Heyes wrote:
> > Thanks to the info from Martijn Pieters this turned out to be trivial.  The
> > unrendered source for a DTML method is reached by appending /document_src to
> > the end of the URL. For example, http://localhost:8080/mystuff becomes
> > http://localhost:8080/mystuff/document_src .  In the context of DAVExplorer
> > the solution is to modify the GET so that the /document_src is appended
> > correctly. Not that this can't be done too early since the URL is used for
> > other internal book keeping. I found that the folowing modification
> > works....
> 
> [SNIP changes to a Java WebDAV client]
> 
> Note that your changes only work for objects that support the document_src
> methods. It may be that now or in the future other objects require you to use
> a different method to retirve the unrendered source.
> 
> I'd still be better if you could find out if there are WebDAV properties about
> the resource accessible in that piece of code, check for the source link, and
> if present, use that instead of the original URL. Such a change can then be
> used on other WebDAV servers prividing the source link as well, and can be
> included in the original client sources.
> 
> -- 
> Martijn Pieters
> | Software Engineer    mailto:mj@digicool.com
> | Digital Creations  http://www.digicool.com/
> | Creators of Zope       http://www.zope.org/
> |   The Open Source Web Application Server
> ---------------------------------------------
Yes, what I did was to look at the RFC that you sent me then look at the 
WebDAV properties that DAVExplorer reads.  The properties for the source 
list looks like...

<n:source>
  <n:link>
     <n:src>
         /test_dtml
     </n:src>
    <n:dst>
        /test_dtml/document_src
    </n:dst>
  <n:link>
</n:source>

... the property tagged by dst is the link to the unrendered source. 
What I really need to do is extract this from the properties rather than 
simply appending /document_src onto the end of everything. As you point 
out (partially) document_src has no meaning in the context of some 
objects and also other WebDAV servers may use a different syntax than 
simply adding /document_src on the end of the URL.

At least this works for Zope. For my next trick ;^) I am going to try to 
make it general, as you suggest and add a "Get Source" menu option so 
that the user has some choice over getting the rendered or unrendered 
source. Also, I am working on adding an "Edit" option which does a "get 
source" into a temp file then fires up the user's editor of choice and a 
thread to monitor the modification time of the temp file. Each time the 
file changes it gets put back into Zope. That way the user can use the 
"Save" command on the editor. (By the way I E-mailed the authors of 
DAVExplorer to get their input. waiting for a reply.)

   Anyway I'm having fun and getting somewhere at last!!

                          Graham 
------------------------------------------------------------------------------- 
Beware of Geeks bearing GIFS. http://www.jlab.org/coda Jefferson lab DAQ 
group