[Zope3-checkins] CVS: Zope3/src/zope/app/http - delete.py:1.1 configure.zcml:1.2
Jim Fulton
jim@zope.com
Fri, 28 Feb 2003 17:34:58 -0500
Update of /cvs-repository/Zope3/src/zope/app/http
In directory cvs.zope.org:/tmp/cvs-serv29156
Modified Files:
configure.zcml
Added Files:
delete.py
Log Message:
Added support for DELETE.
=== Added File Zope3/src/zope/app/http/delete.py ===
##############################################################################
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (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.
##############################################################################
"""XXX short summary goes here.
XXX longer description goes here.
$Id: delete.py,v 1.1 2003/02/28 22:34:28 jim Exp $
"""
__metaclass__ = type
from zope.component import getAdapter
from zope.proxy.context import getWrapperContainer, getWrapperData
from zope.app.interfaces.file import IWriteDirectory
from zope.app.interfaces.container import IZopeWriteContainer
class DELETE:
"""Delete handler for all objects
"""
def __init__(self, context, request):
self.context = context
self.request = request
def DELETE(self):
request = self.request
victim = self.context
container = getWrapperContainer(victim)
name = getWrapperData(victim)['name']
# Get a "directory" surrogate for the container
dir = getAdapter(container, IWriteDirectory)
# Get the zope adapter for that
dir = getAdapter(dir, IZopeWriteContainer)
# Now do the delete
del dir[name]
return ''
=== Zope3/src/zope/app/http/configure.zcml 1.1 => 1.2 ===
--- Zope3/src/zope/app/http/configure.zcml:1.1 Fri Feb 7 10:59:37 2003
+++ Zope3/src/zope/app/http/configure.zcml Fri Feb 28 17:34:28 2003
@@ -40,4 +40,13 @@
allowed_attributes="PUT"
/>
+<view
+ for="*"
+ name="DELETE"
+ type="zope.publisher.interfaces.http.IHTTPPresentation"
+ factory=".delete.DELETE"
+ permission="zope.Public"
+ allowed_attributes="DELETE"
+ />
+
</zopeConfigure>