Opened 8 years ago

Closed 6 years ago

Last modified 6 years ago

#6845 closed defect (wontfix)

RequestDone not allowed in INagivationContributor

Reported by: Michael Ching Owned by: Anton Graham
Priority: normal Component: AuthRequiredPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11


Testing on Trac 0.11.7, it appears that redirect() in an INagivationContributor will cause problems because the RequestDone exception is not handled and will result in a 500 error.

It seems like this plugin would make more sense as a IRequestFilter.

from trac.core import *
from trac.web import IRequestFilter

class AuthRequired(Component):
    Require anonymous users to authenticate using the form based login.
    This has been greatly simplified from the original implementation
    thanks to a hint from coderanger.

    def pre_process_request(self, req, handler):
        if ((req.authname and req.authname != 'anonymous') or \
            req.path_info.startswith('/login') or \
            req.path_info.startswith('/reset_password') or \
            req.path_info.startswith('/register') or \
            return handler
        self.log.debug('Redirecting anonymous request to /login')
        # Testing new redirect syntax.  Thanks to
        req.redirect(req.href.login(), {'referer':req.abs_href(req.path_info)})
        return handler

    def post_process_request(req, template, data, content_type):

Attachments (0)

Change History (2)

comment:1 Changed 6 years ago by Ryan J Ollos

Resolution: wontfix
Status: newclosed

comment:2 Changed 6 years ago by Ryan J Ollos

Plugin is deprecated. See the PermRedirectPlugin.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Anton Graham.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.