[Zope3-checkins] SVN: Zope3/branches/isarsprint-dav-work/src/zope/app/dav/delete.py Add Stephan Richter's initial cut at the DAV DELETE command. Far from complete,

Martijn Pieters mj at zopatista.com
Mon Oct 11 05:39:53 EDT 2004


Log message for revision 27945:
  Add Stephan Richter's initial cut at the DAV DELETE command. Far from complete,
  this code is only checked in to avoid loosing it.
  


Changed:
  A   Zope3/branches/isarsprint-dav-work/src/zope/app/dav/delete.py


-=-
Added: Zope3/branches/isarsprint-dav-work/src/zope/app/dav/delete.py
===================================================================
--- Zope3/branches/isarsprint-dav-work/src/zope/app/dav/delete.py	2004-10-11 09:36:55 UTC (rev 27944)
+++ Zope3/branches/isarsprint-dav-work/src/zope/app/dav/delete.py	2004-10-11 09:39:53 UTC (rev 27945)
@@ -0,0 +1,54 @@
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""WebDAV method DELETE
+
+Implementation of RFC 2518, Section 8.6
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+from zope.app import zapi
+
+
+class DELETE(object):
+    """Delete a Non-Collection Resource
+
+    RFC 2518, Section 8.6.1 requires that we do not just delete the URI
+    specified, but *any* reference of the resource in any collection or
+    internal reference.
+    """
+
+    def DELETE(self):
+        # XXX: Determine whether the resource is locked.
+        locked = None
+        if locked:
+            request.response.setStatus(423)
+            return
+
+        # When we delete a resource (in Python terms 'object') at one place,
+        # we leave it up to the Zope 3 framework to delete all its references.
+        container = zapi.getParent(self.context)
+        del container[zapi.name(self.context)]
+
+
+
+class DELETECollection(object):
+
+    def __init__(self, context, request):
+        self.context = context
+        self.request = request
+        # Make sure that the depth is always 'infinity' as required by the RFC
+        depth = request.getHeader('Depth', 'infinity')
+        if depth is not 'infinity':
+            raise XXXError



More information about the Zope3-Checkins mailing list