Hi guys!

I having problem on triggering a exception inside a component, the
docstring from component tells me to use something like:

<code>
class CustomServletComponent(ServletComponent):

    _handleExceptions = ['HTTPForbidden']

    def exceptionHTTPForbiddenEvent(self, exc):
        self.servlet().write('You are not allowed')
        # self.servlet().response().sendRedirect('NotAllowedWarning')
        return 'break'
</code>

This is wrong, the ServletComponent don't import the Exception, this
way I must use the exception as object, not as string. The
ServletComponent calls HTTPForbiddenEvent (rather than
exceptionHTTPForbiddenEvent)...

I fix my servlet and it becomes:

<code>
class CustomServletComponent(ServletComponent):

    _handleExceptions = [HTTPForbidden]

    def HTTPForbiddenEvent(self, exc):
        self.servlet().write('You are not allowed')
        # self.servlet().response().sendRedirect('NotAllowedWarning')
        return 'break'
</code>

What is the correct syntax or who is wrong, the code or the doc?
Anyway I can't redirect the page to another one or can't write the
data, Is this correct? Am I doing something wrong? Do you have any
working example of handleExceptions usage?

My goal is to catch the Forbidden exception raised by LoginKit, I want
to tell the user it is not allowed to view the content on a better
way...

regards,

-- 
Michel Thadeu Sabchuk
Curitiba - Brasil


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to