Commit 5edd9bec authored by 's avatar

duh

parent 281675d2
...@@ -86,72 +86,5 @@ ...@@ -86,72 +86,5 @@
"""The webdav package provides WebDAV class 1 functionality within """The webdav package provides WebDAV class 1 functionality within
the Zope environment. Based on RFC 2518.""" the Zope environment. Based on RFC 2518."""
__version__='$Revision: 1.1 $'[11:-2] __version__='$Revision: 1.2 $'[11:-2]
# Hacks to inject WebDAV support into standard Zope classes.
from NullResource import NullResource
def folder__getitem__(self, key):
if hasattr(self, 'REQUEST'):
method=self.REQUEST.get('REQUEST_METHOD', 'GET')
if not method in ('GET', 'POST'):
return NullResource(self, key).__of__(self)
raise KeyError, key
def document_put(self, REQUEST, RESPONSE):
"""Handle HTTP PUT requests."""
self.init_headers(RESPONSE)
type=REQUEST.get_header('content-type', None)
body=REQUEST.get('BODY', '')
self._validateProxy(REQUEST)
self.munge(body)
self.on_update()
RESPONSE.setStatus(204)
return RESPONSE
def image_put(self, REQUEST, RESPONSE):
"""Handle HTTP PUT requests"""
self.init_headers(RESPONSE)
type=REQUEST.get_header('content-type', None)
body=REQUEST.get('BODY', '')
if type is None:
type, enc=mimetypes.guess_type(self.id())
if type is None:
if content_types.find_binary(body) >= 0:
type='application/octet-stream'
else: type=content_types.text_type(body)
type=lower(type)
self.update_data(body, type)
RESPONSE.setStatus(204)
return RESPONSE
import OFS.SimpleItem, Resource
class Item(OFS.SimpleItem.Item, Resource.Resource):
pass
Item.__module__='OFS.SimpleItem'
OFS.SimpleItem.Item=Item
class Item_w__name__(OFS.SimpleItem.Item_w__name__, Resource.Resource):
pass
Item_w__name__.__module__='OFS.SimpleItem'
OFS.SimpleItem.Item_w__name__=Item_w__name__
import OFS.Folder, Collection
class Folder(OFS.Folder.Folder, Collection.Collection):
pass
Folder.__module__='OFS.Folder'
OFS.Folder.Folder=Folder
OFS.Folder.Folder.__getitem__=folder__getitem__
import OFS.DTMLDocument, OFS.DTMLMethod, OFS.Image
OFS.DTMLMethod.DTMLMethod.PUT=document_put
OFS.DTMLDocument.DTMLDocument.PUT=document_put
OFS.Image.Image.PUT=image_put
OFS.Image.File.PUT=image_put
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment