[Zope] Catch Unauthorized exception and internal redirect to login DTML doc

David K. Trudgett dkt@registriesltd.com.au
Thu, 30 May 2002 12:07:41 +1000


I'm using exUserFolder to do cookie-based authentication. When a
resource is accessed without authentication, an Unauthorized exception
is generated. At present, I have a couple of lines in
standard_html_header that do an HTTP redirect to the login form:

<META HTTP-EQUIV=Expires CONTENT="<dtml-var "ZopeTime()-1"
fmt="%Y-%m-%d">">
<META HTTP-EQUIV=Refresh CONTENT="0;
URL=&dtml-URL1;/acl_users/redirectToLogin?destination=&dtml-URL;<dtml-if
"REQUEST.has_key('authFailedCode')">&authFailedCode=&dtml-authFailedCode;</dtml-if>">


This does a browser redirect to the login form, but not before the
visitor sees the error page.

How can I get Zope to do an internal redirect to my login form when an
Unauthorized exception is generated?

Thanks for any tips or pointers!

David Trudgett