Modify

Opened 14 years ago

Closed 12 years ago

Last modified 12 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

Description

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):
    """AuthRequiredPlugin
    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.
       """
    implements(IRequestFilter)

    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')
        #req.redirect(req.href.login())
        # Testing new redirect syntax.  Thanks to jfernandez@ist.psu.edu
        req.redirect(req.href.login(), {'referer':req.abs_href(req.path_info)})
        return handler

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

Attachments (0)

Change History (2)

comment:1 Changed 12 years ago by Ryan J Ollos

Resolution: wontfix
Status: newclosed

comment:2 Changed 12 years ago by Ryan J Ollos

Plugin is deprecated. See the PermRedirectPlugin.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Anton Graham.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.