Edgewall Software
Modify

Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#11531 closed defect (fixed)

KeyError: 'panel_id' (PreferencesModule can't be set as default_handler)

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:

Description

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)
GIT 1.8.1.2
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
SQLite 3.7.15.2
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
    dispatcher.dispatch(req)
  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)
    7070
    71         panel_id = req.args['panel_id']
     71        panel_id = req.args.get('panel_id')
    7272
    7373        panels = []
    7474        chosen_provider = None

Attachments (0)

Change History (3)

comment:1 by Ryan J Ollos, 6 years ago

Reporter: changed from anonymous to Ryan J Ollos

comment:2 by Ryan J Ollos, 6 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.

comment:3 by Ryan J Ollos, 5 years ago

Keywords: default_handler preferences → default_handler, preferences

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to as closed The owner will be changed from Ryan J Ollos 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.