[Zope3-checkins] CVS: Zope3/src/zope/app/http/exception - notfound.py:1.1 configure.zcml:1.2

Sidnei da Silva sidnei@x3ng.com.br
Wed, 2 Apr 2003 15:37:44 -0500


Update of /cvs-repository/Zope3/src/zope/app/http/exception
In directory cvs.zope.org:/tmp/cvs-serv7023

Modified Files:
	configure.zcml 
Added Files:
	notfound.py 
Log Message:
NotFoundError should return 404, not 500

=== Added File Zope3/src/zope/app/http/exception/notfound.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.
#
##############################################################################
"""

$Id: notfound.py,v 1.1 2003/04/02 20:37:43 sidnei Exp $
"""
__metaclass__ = type

from zope.app.interfaces.http import IHTTPException

class NotFound:

    __implements__ = IHTTPException

    def __init__(self, context, request):
        self.context = context
        self.request = request

    def __call__(self):
        self.request.response.setStatus(404)
        return ''

    __str__ = __call__


=== Zope3/src/zope/app/http/exception/configure.zcml 1.1 => 1.2 ===
--- Zope3/src/zope/app/http/exception/configure.zcml:1.1	Sat Mar 29 12:03:59 2003
+++ Zope3/src/zope/app/http/exception/configure.zcml	Wed Apr  2 15:37:43 2003
@@ -8,4 +8,12 @@
     factory=".unauthorized.Unauthorized"
     />
 
+<defaultView 
+    for="zope.exceptions.INotFoundError"	
+    type="zope.publisher.interfaces.http.IHTTPPresentation"
+    name="index.html"
+    permission="zope.Public"
+    factory=".notfound.NotFound"
+    />
+
 </zopeConfigure>