[Zope-Checkins] CVS: Zope2 - Resource.py:1.42.12.1
Martijn Pieters
mj@digicool.com
Mon, 23 Apr 2001 10:28:29 -0400 (EDT)
Update of /cvs-repository/Zope2/lib/python/webdav
In directory korak:/tmp/cvs-serv31242/webdav
Modified Files:
Tag: mj-http_range_support-branch
Resource.py
Log Message:
- Move HTTP Range methods to own module.
- Create a HTTPRangeInterface flag interface so we can test for support.
- Have WebDAV enabled objects set 'Accept-Ranges: bytes' for supporting
objects and 'Accept-Ranges: none' for the rest.
- Add ETag support to If-Range (ETags were already generated for Image and
File objects, just not updated when the contents of the resource changed).
- Removed some unused imports.
--- Updated File Resource.py in package Zope2 --
--- Resource.py 2001/03/27 19:52:11 1.42
+++ Resource.py 2001/04/23 14:28:28 1.42.12.1
@@ -94,6 +94,7 @@
from AccessControl import getSecurityManager
from WriteLockInterface import WriteLockInterface
import Globals, time
+from ZPublisher.HTTPRangeSupport import HTTPRangeInterface
class Resource(ExtensionClass.Base, Lockable.LockableItem):
"""The Resource mixin class provides basic WebDAV support for
@@ -130,6 +131,12 @@
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')
def dav__validate(self, object, methodname, REQUEST):
msg='<strong>You are not authorized to access this resource.</strong>'