[Zope] I don't want WebDav

Paul Tiemann pault@center7.com
Thu, 11 Jul 2002 10:19:17 -0600


> Is there a way to disable WebDav when downloading word documents? 

I had the same problem yesterday.   There may be other ways to solve it, but 
this is how I did it:

Look in your Z2.log (or wherever your access log is) and you will see that 
MsWord sends an OPTIONS request to Zope for the document file that it is 
trying to open.  I found that the default behavior of almost all Zope objects 
is to reply to OPTIONS requests by setting a few dav oriented headers, and 
giving lots of options (HEAD,PUT,POST,PROPFIND,MOVE,DELETE,etc)...  You can 
find the method I'm talking about in your lib/python/webdav/Resource.py file 
under the OPTIONS method of the Resource class.

To solve the problem in my case, I copied that method into my product so that 
when an OPTIONS request comes for my product it finds MY method instead of 
inheriting it from Resource.  I changed my method so that it doesn't output 
any of the Dav oriented headers, and it also gives less allowed options...  
After that was done my problem cleared up.

Here is a copy of the modified method that you'll need to put into your 
product code:  (Note the two commented lines, and the change for the 'Allow' 
header)

def OPTIONS(self, REQUEST, RESPONSE):
  """Retrieve communication options."""
  #self.dav__init(REQUEST, RESPONSE)
  RESPONSE.setHeader('Allow', 'GET, HEAD, OPTIONS, TRACE')
  RESPONSE.setHeader('Content-Length', 0)
  #RESPONSE.setHeader('DAV', '1,2', 1)
  RESPONSE.setStatus(200)
  return RESPONSE

One other note:  In my case, MsWord sent OPTIONS requests for the document it 
was retrieving, and ALSO for the parent directory of the document.  You may 
need to make sure that any OPTIONS request for your document as well as for 
the product that is creating the documents both return the limited OPTIONS.

(In my case, Word was trying to lock documents, but since I use cookie-based 
authentication, it doesn't send correct login information in the request, and 
a very inconvenient password dialog box would pop up any time someone tried 
to view MsOffice documents)

Good luck with the solution-
Paul