Edgewall Software
Modify

Opened 14 years ago

Closed 14 years ago

#8808 closed defect (fixed)

KeyError: <Option [account-manager] "account_changes_notify_addresses">

Reported by: termim@… Owned by: Remy Blank
Priority: high Milestone: 0.12
Component: general Version: 0.12dev
Severity: normal Keywords: multirepos
Cc: termim@…, r.rossmair@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

My Trac (multirepos-r8782) instance uses AccountManagerPlugin and requires login to view the contents. By chance I've discovered that if I click on the "About Trac" link without logging in then everything is fine, but after logging in it produces an internal error shown below. Obviously it is somehow related to the AccountManagerPlugin plugin and how (badly :) I've configured it, but IMHO Trac should not fail so disgracefully on the about page and the code where the exception happens looks suspicious - the dictionary components is filled up from one source ComponentMeta._components, but then items are extracted from it by keys that are taken from another source - Option.registry.items(). Probably these sources should be in sync but they are not in this case. IMHO the proper fix would somehow combine these two sources into one and eliminate such an errors all together but the following simple patch plugged it for me

Index: config.py
===================================================================
--- config.py	(revision 8782)
+++ config.py	(working copy)
@@ -485,7 +485,7 @@
                 if isinstance(attr, Option):
                     components[attr] = cls
         return dict(each for each in Option.registry.items()
-                    if compmgr.is_enabled(components[each[1]]))
+                    if each[1] in components and compmgr.is_enabled(components[each[1]]))
     
     def __init__(self, section, name, default=None, doc=''):
         """Create the configuration option.

How to Reproduce

While doing a GET operation on /about, Trac issued an internal error.

(please provide additional details here)

User Agent was: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.2) Gecko/20090730 SUSE/3.5.2-2.1 Firefox/3.5.2 GTB5

System Information

Trac 0.12multirepos-r8782
Python 2.5.2 (r252:60911, Jun 7 2008, 00:38:48)
[GCC 4.3.1 20080507 (prerelease) [gcc-4_3-branch revision 135036]]
setuptools 0.6c11
SQLite 3.6.14
pysqlite 2.4.1
Genshi 0.6dev-r1052
Babel -
mod_python 3.3.1
Pygments 1.0
jQuery: 1.3.2

Python Traceback

Traceback (most recent call last):
  File "/usr/local/lib64/python2.5/site-packages/trac/web/main.py", line 486, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/local/lib64/python2.5/site-packages/trac/web/main.py", line 223, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/local/lib64/python2.5/site-packages/trac/about.py", line 64, in process_request
    defaults = self.config.defaults(self.compmgr)
  File "/usr/local/lib64/python2.5/site-packages/trac/config.py", line 147, in defaults
    for (section, key), option in Option.get_registry(compmgr).items():
  File "/usr/local/lib64/python2.5/site-packages/trac/config.py", line 487, in get_registry
    return dict(each for each in Option.registry.items()
  File "/usr/local/lib64/python2.5/site-packages/trac/config.py", line 488, in <genexpr>
    if compmgr.is_enabled(components[each[1]]))
KeyError: <Option [account-manager] "account_changes_notify_addresses">

Attachments (0)

Change History (5)

comment:1 by Remy Blank, 14 years ago

Owner: set to Remy Blank

I'll look into this.

comment:2 by Robert Rossmair <r.rossmair@…>, 14 years ago

Cc: r.rossmair@… added

comment:3 by termim, 14 years ago

Milestone: 0.12-multirepos0.12

comment:4 by Remy Blank, 14 years ago

This is due to AccountManagerPlugin defining that particular option ([account-manager] account_changes_notify_addresses) in a class that is not a Component. When I wrote that code, I assumed this was a requirement, but this is not the case.

comment:5 by Remy Blank, 14 years ago

Resolution: fixed
Status: newclosed

Fixed in [8804]. As we have no way of knowing if an Option defined in a non-Component class is enabled or not, it will always be shown. Of course, it would be better if AccountManagerPlugin defined that Option in e.g. AccountChangeListener, so that it can be hidden if the component is disabled.

Thanks for the bug report!

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Remy Blank.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Remy Blank to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.