Edgewall Software
Modify

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#9697 closed defect (fixed)

"KeyError: captcha_redirect" after logging in during captcha

Reported by: anonymous Owned by: Dirk Stöcker
Priority: normal Milestone: plugin - spam-filter
Component: plugin/spamfilter Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:

Description

Steps to reproduce:

  1. Log out of Trac
  2. Attempt to add a comment on a ticket. (This redirects to captcha.)
  3. Log in. (This returns user to captcha page.)
  4. Submit captcha

Expected result: Comment submits successfully on step 4, or user is redirected to a non-captcha page on step 3.

Actual result:

2010-10-17 19:47:53,709 Trac[main] ERROR: Internal Server Error:
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/Trac-0.12-py2.6.egg/trac/web/main.py", line 513, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/local/lib/python2.6/dist-packages/Trac-0.12-py2.6.egg/trac/web/main.py", line 200, in dispatch
    chosen_handler)
  File "/usr/local/lib/python2.6/dist-packages/Trac-0.12-py2.6.egg/trac/web/main.py", line 346, in _pre_process_request
    chosen_handler = filter_.pre_process_request(req, chosen_handler)
  File "/usr/local/lib/python2.6/dist-packages/TracSpamFilter-0.4.1dev_r10170-py2.6.egg/tracspamfilter/captcha/api.py", line 119, in pre_process_request
    del req.session['captcha_redirect']
KeyError: 'captcha_redirect'

Attachments (0)

Change History (2)

comment:1 by anonymous, 9 years ago

Resolution: fixed
Status: newclosed

In r10276.

comment:2 by Remy Blank, 9 years ago

You should rather use the in operator to check for a key in a dictionary:

if 'captcha_redirect' in req.session: 
    del req.session['captcha_redirect']

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Dirk Stöcker.
The resolution will be deleted.
to The owner will be changed from Dirk Stöcker 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.