Edgewall Software

Opened 10 years ago

Closed 10 years ago

Last modified 7 years ago

#11597 closed enhancement (fixed)

Allow setting default_handler as a session preference — at Version 7

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.1.2
Component: general Version:
Severity: normal Keywords: session, preferences, default_handler
Cc: Branch:
Release Notes:

The default_handler can be set as a session preference.

API Changes:
Internal Changes:

Description

The proposed feature will make it possible to set the default_handler from the Preferences page or using a TracAdmin command (trac-admin session set). The feature was previously mentioned in comment:17:ticket:11519.

Together with an enhancement to be proposed to the th:AccountManagerPlugin, this will support convenient configuration of a use-case for which I've previously used the th:GroupBasedRedirectionPlugin - having members of groups/teams arrive at different pages when logging in to Trac.

Change History (7)

comment:1 by Ryan J Ollos, 10 years ago

Status: newassigned

comment:2 by Ryan J Ollos, 10 years ago

The core functionality has been implemented in log:rjollos.git:t11597. However, I'll add tests before committing.

comment:3 by Jun Omae, 10 years ago

I don't think the selected handler is always valid for default handler. I think we should check whether the handler is valid.

  • trac/web/main.py

    diff --git a/trac/web/main.py b/trac/web/main.py
    index 3303337..6574b66 100644
    a b class RequestDispatcher(Component):  
    276276        # Use default_handler from the Session if it is a valid value.
    277277        name = req.session.get('default_handler')
    278278        handler = self._request_handlers.get(name)
     279        if handler and not is_valid_default_handler(handler):
     280            handler = None
    279281
    280282        if not handler:
    281283            # Use default_handler from project configuration.

comment:4 by Ryan J Ollos, 10 years ago

Good catch. I will include it and make sure we have test coverage.

comment:5 by Ryan J Ollos, 10 years ago

log:rjollos.git:t11597.2 contains some refactoring of the proposed changes. Functional tests still need to be added.

comment:6 by Ryan J Ollos, 10 years ago

Proposed changes in log:rjollos.git:t11597.3, with functional and unit tests.

comment:7 by Ryan J Ollos, 10 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed to trunk in [12922].

Note: See TracTickets for help on using tickets.