Edgewall Software

Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#11531 closed defect (fixed)

KeyError: 'panel_id' (PreferencesModule can't be set as default_handler) — at Version 2

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

PreferencesModule can be set as the default_handler.

API Changes:
Internal Changes:


How to Reproduce

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

With [trac] default_handler = PreferencesModule.

Request parameters:


User agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/31.0.1650.63 Chrome/31.0.1650.63 Safari/537.36

System Information

Trac 1.1.2dev-r0
Babel 0.9.6 (translations unavailable)
Docutils 0.10
Genshi 0.6.1 (without speedups)
Pygments 1.6dev-20140311
pysqlite 2.6.3
Python 2.7.4 (default, Sep 26 2013, 03:20:26)
[GCC 4.7.3]
pytz 2013d
setuptools 0.6
Subversion 1.8.8 (r1568071)
jQuery 1.8.3

Enabled Plugins

Python Traceback

Traceback (most recent call last):
  File "/home/user/Workspace/t11519/teo-rjollos.git/trac/web/main.py", line 517, in _dispatch_request
  File "/home/user/Workspace/t11519/teo-rjollos.git/trac/web/main.py", line 221, in dispatch
    resp = chosen_handler.process_request(req)
  File "/home/user/Workspace/t11519/teo-rjollos.git/trac/prefs/web_ui.py", line 71, in process_request
    panel_id = req.args['panel_id']
KeyError: 'panel_id'

It's a bit of a corner case, but the fix is easy.

  • trac/prefs/web_ui.py

    diff --git a/trac/prefs/web_ui.py b/trac/prefs/web_ui.py
    index 5a428c2..a15a3de 100644
    a b class PreferencesModule(Component):  
    6868        if xhr and req.method == 'POST' and 'save_prefs' in req.args:
    6969            self._do_save_xhr(req)
    71         panel_id = req.args['panel_id']
     71        panel_id = req.args.get('panel_id')
    7373        panels = []
    7474        chosen_provider = None

Change History (2)

comment:1 by Ryan J Ollos, 8 years ago

Reporter: changed from anonymous to Ryan J Ollos

comment:2 by Ryan J Ollos, 8 years ago

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

Fixed in [12573] and merged to trunk in [12576]. A TODO has been added in comment:7:ticket:11520.

Note: See TracTickets for help on using tickets.