Modify

Opened 10 years ago

Closed 7 years ago

#11469 closed defect (fixed)

Exceptions in AccountModule._reset_password_enabled are not trapped in Trac 1.0.2dev

Reported by: Ryan J Ollos Owned by: Steffen Hoffmann
Priority: normal Component: AccountManagerPlugin
Severity: normal Keywords:
Cc: Trac Release:

Description

While investigating #10980 using Trac 1.0.2dev, with the reporter's configuration I immediately saw a warning:

close Warning: Error with navigation contributor "AccountModule"

It looks like some changes are needed after [trac 12068].

  • accountmanagerplugin/trunk/acct_mgr/web_ui.py

    diff --git a/accountmanagerplugin/trunk/acct_mgr/web_ui.py b/accountmanagerplugi
    index 0611206..3713dfe 100644
    a b from genshi.builder import tag 
    1919
    2020from trac import perm, util
    2121from trac.core import Component, implements
    22 from trac.config import Configuration, BoolOption, IntOption, Option
     22from trac.config import Configuration, ConfigurationError, BoolOption, \
     23                        IntOption, Option
    2324from trac.env import open_environment
    2425from trac.prefs import IPreferencePanelProvider
    2526from trac.util import hex_entropy
    class AccountModule(CommonTemplateProvider): 
    106107    def _reset_password_enabled(self, log=False):
    107108        try:
    108109            self.store.hash_method
    109         except AttributeError:
     110        except (AttributeError, ConfigurationError):
    110111            return False
    111112        return is_enabled(self.env, self.__class__) and \
    112113               self.reset_password and (self._write_check(log) != []) and \

Attachments (0)

Change History (5)

comment:1 Changed 9 years ago by Steffen Hoffmann

In 14274:

AccountManagerPlugin: Define a compatibility class for trapping a new Trac exception, refs #11469.

New error class ConfigurationError has been added during development for
1.0.2, and AccountModule must handle it gracefully for that and all coming
versions of Trac.

comment:2 in reply to:  1 Changed 9 years ago by Ryan J Ollos

Replying to hasienda:

New error class ConfigurationError has been added during development for 1.0.2, and AccountModule must handle it gracefully for that and all coming versions of Trac. }}}

That class was actually available back in Trac 0.11, possibly earlier: browser:/tags/trac-0.11/trac/config.py@:29-30#L15. The change on 1.0.2 was just to raise that exception class when ExtensionOption has an Interface that is not registered.

comment:3 Changed 9 years ago by Steffen Hoffmann

Ok, clearly I misunderstood Trac changeset 12068 then. Thanks for pointing this out.

comment:4 Changed 9 years ago by Steffen Hoffmann

In 14277:

AccountManagerPlugin: Remove compatibility class, refs #11469.

Actually ConfigurationError has already been available in Trac 0.10, so
the compatibility code from [14274] is obsolete and removed, effectively
reverting to the originally proposed changes.

Thanks to Ryan J Ollos for initial report as well as for reviewing most of
my changes.

comment:5 Changed 7 years ago by Ryan J Ollos

Resolution: fixed
Status: newclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Steffen Hoffmann.
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.