Modify

Opened 4 years ago

Closed 21 months ago

Last modified 21 months ago

#6845 closed defect (wontfix)

RequestDone not allowed in INagivationContributor

Reported by: mkc Owned by: BladeHawke
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 21 months ago by rjollos

  • Resolution set to wontfix
  • Status changed from new to closed

comment:2 Changed 21 months ago by rjollos

Plugin is deprecated. See the PermRedirectPlugin.

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from BladeHawke. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.