[Zope] how to catch the error message following the failed login via dtm l-try dtml-except

Deniz, Metin Metin.Deniz@commerzbankib.com
Wed, 11 Jun 2003 17:07:18 +0200


Hello everybody,

I have the following problem:
I have created a website which is generally accessible to everybody without
the need to login(user = anonymous).
Some areas of the site are reserved only to users who have an account in the
acl users folders.
When a user tries to access the restricted areas but does not have the right
to or pushes the cancel button, then he gets the following error message:

Site Error
An error was encountered while publishing this resource. 

Unauthorized

You are not authorized to access this resource. 

Traceback (innermost last):
  File C:\Zope\lib\python\ZPublisher\Publish.py, line 150, in publish_module
  File C:\Zope\lib\python\ZPublisher\Publish.py, line 114, in publish
  File C:\Zope\lib\python\Zope\__init__.py, line 158, in
zpublisher_exception_hook
    (Object: logintest)
  File C:\Zope\lib\python\ZPublisher\Publish.py, line 89, in publish
  File C:\Zope\lib\python\ZPublisher\BaseRequest.py, line 404, in traverse
  File C:\Zope\lib\python\ZPublisher\HTTPResponse.py, line 511, in
unauthorized
Unauthorized: (see above)


Here is the example code which produces this error:

<dtml-var standard_html_header>
<dtml-try>
  User:  <dtml-var "AUTHENTICATED_USER.getUserName()">
<dtml-except>
  Failed to login  
</dtml-try>
<dtml-var standard_html_footer>

Unfortunatelly it does not work. Instead I just get the above error message.

Do you have any idea as how to do it?


Regards,



Metin Deniz