Vahur Rebas wrote:
found this somewhat old post from zpt-list but the topic is interesting so... can you give some details how you hack-patch msoffice?
I don't patch msoffice, I patch Zope so that it doesn't send the crap that gets MS office thinking it has write access to your service when it doesn't ;-) Bug me again in a few days, I'll have to re-make the patch for Zope 2.7 soon anyway... Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
Chris Withers wrote:
Vahur Rebas wrote:
found this somewhat old post from zpt-list but the topic is interesting so... can you give some details how you hack-patch msoffice?
I don't patch msoffice, I patch Zope so that it doesn't send the crap that gets MS office thinking it has write access to your service when it doesn't ;-)
I understood that you don't patch MS :)
Bug me again in a few days, I'll have to re-make the patch for Zope 2.7 soon anyway...
I'm now bugging you again. Vahur
Vahur Rebas wrote:
I'm now bugging you again.
Dump the following in a file called __init__.py in a folder called WebDAVPatch in your Products directory: # Disable MS-Author-via = DAV by monkey patch from ZPublisher.HTTPRangeSupport import HTTPRangeInterface from webdav.Resource import Resource, rfc1123_date def dav__init(self, request, response): # Init expected HTTP 1.1 / WebDAV headers which are not # currently set by the base response object automagically. # # Note we set an borg-specific header for ie5 :( Also, we # sniff for a ZServer response object, because we don't # want to write duplicate headers (since ZS writes Date # and Connection itself). if not hasattr(response, '_server_version'): response.setHeader('Connection', 'close') response.setHeader('Date', rfc1123_date(), 1) # response.setHeader('MS-Author-Via', 'DAV') # HTTP Range support if HTTPRangeInterface.isImplementedBy(self): response.setHeader('Accept-Ranges', 'bytes') else: response.setHeader('Accept-Ranges', 'none') Resource.dav__init = dav__init def OPTIONS(self, REQUEST, RESPONSE): """Retrieve communication options.""" self.dav__init(REQUEST, RESPONSE) RESPONSE.setHeader('Allow', ', '.join(self.__http_methods__)) RESPONSE.setHeader('Content-Length', 0) # RESPONSE.setHeader('DAV', '1,2', 1) RESPONSE.setStatus(200) return RESPONSE Resource.OPTIONS = OPTIONS from webdav.Collection import Collection, rfc1123_date def dav__init(self, request, response): # We are allowed to accept a url w/o a trailing slash # for a collection, but are supposed to provide a # hint to the client that it should be using one. # [WebDAV, 5.2] pathinfo=request.get('PATH_INFO','') if pathinfo and pathinfo[-1] != '/': location='%s/' % request['URL1'] response.setHeader('Content-Location', location) response.setHeader('Connection', 'close', 1) response.setHeader('Date', rfc1123_date(), 1) # response.setHeader('MS-Author-Via', 'DAV') Collection.dav__init = dav__init As a note to anyone reading, this crap will be GOING AWAY on both the 2.7 branch and the HEAD this Friday unless someone can give me some compelling reason for it not to ;-) http://zope.org/Collectors/Zope/1441 cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
BTW, this pain and suffering is now gone in CVS and SVN, and so you won't need to do this anymore in Zope 2.8 or 2.7.3 :-) Chris Chris Withers wrote:
Vahur Rebas wrote:
I'm now bugging you again.
Dump the following in a file called __init__.py in a folder called WebDAVPatch in your Products directory:
# Disable MS-Author-via = DAV by monkey patch
from ZPublisher.HTTPRangeSupport import HTTPRangeInterface from webdav.Resource import Resource, rfc1123_date
def dav__init(self, request, response): # Init expected HTTP 1.1 / WebDAV headers which are not # currently set by the base response object automagically. # # Note we set an borg-specific header for ie5 :( Also, we # sniff for a ZServer response object, because we don't # want to write duplicate headers (since ZS writes Date # and Connection itself). if not hasattr(response, '_server_version'): response.setHeader('Connection', 'close') response.setHeader('Date', rfc1123_date(), 1) # response.setHeader('MS-Author-Via', 'DAV')
# HTTP Range support if HTTPRangeInterface.isImplementedBy(self): response.setHeader('Accept-Ranges', 'bytes') else: response.setHeader('Accept-Ranges', 'none')
Resource.dav__init = dav__init
def OPTIONS(self, REQUEST, RESPONSE): """Retrieve communication options.""" self.dav__init(REQUEST, RESPONSE) RESPONSE.setHeader('Allow', ', '.join(self.__http_methods__)) RESPONSE.setHeader('Content-Length', 0) # RESPONSE.setHeader('DAV', '1,2', 1)
RESPONSE.setStatus(200) return RESPONSE
Resource.OPTIONS = OPTIONS
from webdav.Collection import Collection, rfc1123_date
def dav__init(self, request, response): # We are allowed to accept a url w/o a trailing slash # for a collection, but are supposed to provide a # hint to the client that it should be using one. # [WebDAV, 5.2] pathinfo=request.get('PATH_INFO','') if pathinfo and pathinfo[-1] != '/': location='%s/' % request['URL1'] response.setHeader('Content-Location', location) response.setHeader('Connection', 'close', 1) response.setHeader('Date', rfc1123_date(), 1) # response.setHeader('MS-Author-Via', 'DAV')
Collection.dav__init = dav__init
As a note to anyone reading, this crap will be GOING AWAY on both the 2.7 branch and the HEAD this Friday unless someone can give me some compelling reason for it not to ;-)
http://zope.org/Collectors/Zope/1441
cheers,
Chris
-- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
participants (2)
-
Chris Withers -
Vahur Rebas