Edgewall Software
Modify

Opened 17 years ago

Closed 17 years ago

Last modified 6 years ago

#7148 closed defect (fixed)

NameError: global name 'captcha' is not defined

Reported by: shendric@… Owned by: Christian Boos
Priority: normal Milestone: not applicable
Component: plugin/spamfilter Version: devel
Severity: normal Keywords:
Cc: shendric@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Using r6876 of trac and spam-filter-captcha I get the following error when a ticket is identified as spam. The error shows itself only after enabling the CaptchaSystem as the reject_handler.

[spam-filter]
...
reject_handler = CaptchaSystem

(Sorry, I'm learning more about Python to help debug stuff, but it's slow. Sorry.)

How to Reproduce

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

(please provide additional details here)

User Agent was: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9b5) Gecko/2008041514 Firefox/3.0b5

System Information

Trac 0.11dev-r6873
Python 2.4.3 (#2, Oct 6 2006, 08:04:11)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)]
setuptools 0.6c8
SQLite 3.2.8
pysqlite 2.0.5
Genshi 0.4.4
mod_python < 3.2
Subversion 1.3.1 (r19032)
jQuery: 1.2.3

Python Traceback

Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/Trac-0.11dev_r6873-py2.4.egg/trac/web/main.py", line 417, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.4/site-packages/Trac-0.11dev_r6873-py2.4.egg/trac/web/main.py", line 197, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/lib/python2.4/site-packages/TracSpamFilter-0.2dev_r6876-py2.4.egg/tracspamfilter/captcha/api.py", line 88, in process_request
    captcha['challenge'] = html
NameError: global name 'captcha' is not defined

Attachments (0)

Change History (5)

comment:1 by Christian Boos, 17 years ago

Owner: changed from Matthew Good to Christian Boos

Ah sorry, the "cleanup" was a bit hasty. Simply use r6874 for now.

comment:2 by shendric@…, 17 years ago

Cc: shendric@… added

Just let me know when you'd like me to test a new version :) Thanks!

comment:3 by Christian Boos, 17 years ago

Milestone: not applicable
Resolution: fixed
Status: newclosed

Fixed in r6881 - please try out r6883 (in sync with the main SpamFilter plugin).

Note that this time I also tested the "Image" handler, which works also quite nicely. Activate it with:

[spam-filter]
...
(your other spam-filter entries)
...
reject_handler = CaptchaSystem
captcha = ImageCaptcha

comment:4 by anonymous, 17 years ago

Great, this is close. Thanks!

Two things: 1) I am now able to use the non-image handler. However, after resolving the equation, I have to start over with a new ticket. Assuming that the person spent a long time submitting the ticket, it would probably be preferable to submit the ticket that they were trying to fill out the first time.

2) With the ImageCaptcha handler, I get a new error:

Trac detected an internal error: AttributeError: Cannot find an implementation of the "ICaptchaMethod" interface named "ImageCaptcha". Please update the option spam-filter.captcha in trac.ini.

comment:5 by Christian Boos, 17 years ago

About 1: yes, I agree (I wrote a warning/TODO about this in SpamFilter#AbouttheCaptchavariant) - feel free to open a new ticket if you don't see the feature coming in the next days ;-)

About 2: it's probably because the tracspamfilter.captcha.image module was not loaded, check in your trac.log near the beginning. Common failure causes:

  • you haven't enabled the component
  • you have no PIL installed or it was not installed using setuptools (use easy_install PIL, which should do the job)

Modify Ticket

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