[Zope] How to redirect an unauthorized access ?
Dieter Maurer
dieter@handshake.de
Fri, 15 Mar 2002 20:51:33 +0100
Pascal Samuzeau writes:
> In my first page of my site I have a link named "Administration",
> reserved to the administrators.
>
> In fact, anyone may try this link and have a hope to connect.
> Unfortunately, when they try, they are rejected after three times, and
> they got this error ( an extract ) :
>
> $ZOPEROOT/lib/python/ZPublisher/HTTPResponse.py, line 581, in
> unauthorized
>
> I want to use the zope facilities in order to create a new html page
> for the people who wants to connect to my site, but without the rights
> administrator. I want have a look of my site with a special message to
> tell them that it's not possible, because they are not administrators.
>
> How can I do this? Where I have to lokk ta realize this ? Do I have to
> change HTTPResponse.py ?
When you use a recent Zope version (2.4 or 2.5), then you should
be able to customize "standard_error_message" to give these
exceptions a specific error page.
Alternatively, you may look at a User Folder with cookie based authentication.
It shows you how to catch "Unauthorized" exceptions explicitly.
Dieter