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

Graham Heyes heyes@jlab.org
Tue, 30 May 2000 14:30:47 -0400


Itamar Shtull-Trauring wrote:
> 
> Graham Heyes wrote:
> 
> > Hello,
> >    I have been using Zope to set up a new web site for documentation and 
> > maintainance os a large software project. Until now I have been using a 
> > combination of LocalFS and ftp to edit content. Neither method is 
> > perfect especially since I often work from my laptop at home which is on 
> > the wrong side of the firewall and can't get ftp to work.
> >    Just the other day I discovered WebDav and life looks much better. I 
> > can tunnel my connection to port 8080 through ssh and manage my Zope 
> > site from home. One problem remains:
> > 
> > When I use "get" or "edit" to get a DTML method (web page in my case) 
> > from the site I get a page with all the DTML tags expanded.  This is 
> > clearly useless to me since I don't want to edit the rendered DTML but 
> > the original code. Am I doing something wrong (I hope so) if so what 
> > should I do?
> > 
> > I am using Zope 1.whatever but also tried Zope2. I am running on RedHat 
> > Linux 6.1 with Apache web server but I point the WebDAV tools at 
> > http://localhost:8080/ <"http://localhost:8080/"> i.e. the ZServer. I have tried the "cadaver" 
> > command line tool and "DAVExplorer" java application with the same result.
> 
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....

In dav_explorer/classes/DAVExplorer/WebDAVManager.java  make the 
following change at line number 119 ...

       try {
             Response = Con.Generic(MethodName, ResourceName, Body, 
Headers);

             WebDAVResponseEvent webdavResponse  = 
GenerateWebDAVResponse(Response,tn);
           fireResponse(webdavResponse);
       }

... becomes ...

   try {
       if (MethodName.equals("GET")) {
             Response = Con.Generic(MethodName, ResourceName + 
"/document_src", Body, Headers);
       } else {
             Response = Con.Generic(MethodName, ResourceName, Body, 
Headers);
       }
             WebDAVResponseEvent webdavResponse  = 
GenerateWebDAVResponse(Response,tn);
           fireResponse(webdavResponse);
       }
  
... note you don't need to change PUT since PUT does the right thing. 
I've tested this out quickly and it seems to do what I want.

The sources to DAVExplorer can be found via a link at www.webdav.org to
http://www.ics.uci.edu/~webdav/ enjoy!

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