Edgewall Software

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:


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
  File "/usr/local/lib/python2.6/dist-packages/Trac-0.12-py2.6.egg/trac/web/main.py", line 200, in dispatch
  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
as closed The owner will remain Dirk Stöcker.
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.