[Zope3-checkins] CVS: Zope3/src/zope/app/http/exception - __init__.py:1.1 configure.zcml:1.1 unauthorized.py:1.1
Sidnei da Silva
sidnei@x3ng.com.br
Sat, 29 Mar 2003 12:04:00 -0500
Update of /cvs-repository/Zope3/src/zope/app/http/exception
In directory cvs.zope.org:/tmp/cvs-serv25288/exception
Added Files:
__init__.py configure.zcml unauthorized.py
Log Message:
Adding exception handler for unauthorized http exception. Should omit WWW-Authenticate headers.
=== Added File Zope3/src/zope/app/http/exception/__init__.py ===
# empty __init__.py file to make this directory into a package
=== Added File Zope3/src/zope/app/http/exception/configure.zcml ===
<zopeConfigure xmlns="http://namespaces.zope.org/zope">
<defaultView
for="zope.exceptions.IUnauthorized"
type="zope.publisher.interfaces.http.IHTTPPresentation"
name="index.html"
permission="zope.Public"
factory=".unauthorized.Unauthorized"
/>
</zopeConfigure>
=== Added File Zope3/src/zope/app/http/exception/unauthorized.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: unauthorized.py,v 1.1 2003/03/29 17:03:59 sidnei Exp $
"""
__metaclass__ = type
from zope.app.interfaces.http import IHTTPException
class Unauthorized:
__implements__ = IHTTPException
def __init__(self, context, request):
self.context = context
self.request = request
def __call__(self):
self.request.unauthorized("basic realm='Zope'")
return ''
__str__ = __call__