Edgewall Software
Modify

Opened 12 years ago

Closed 12 years ago

#10490 closed defect (fixed)

Spam Filter Plugin Error: "UnboundLocalError: local variable 'blogspam' referenced before assignment"

Reported by: manuel.holtgrewe@… Owned by: Dirk Stöcker
Priority: normal Milestone:
Component: plugin/spamfilter Version:
Severity: major Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Setup

I installed the SpamFilter plugin (svn checkout, python setup.py bdist_egg) and installed it via upload in the Admin/Plugins section. My trac version is 0.12.2, I have revision 10882 of the 0.12 branch of the spam-filter-captcha plugin.

Error

To reproduce:

  • enable the external service admin admin pane
  • go to /admin/spamfilter/external
  • uncheck "Use external services"
  • click "Apply Changes".

You are now presented with an error message reading

Trac detected an internal error:
UnboundLocalError: local variable 'blogspam' referenced before assignment
This is probably a local installation issue.

The traceback is

File "/usr/lib/python2.6/dist-packages/trac/web/main.py", line 511, in _dispatch_request
  dispatcher.dispatch(req)
File "/usr/lib/python2.6/dist-packages/trac/web/main.py", line 237, in dispatch
  resp = chosen_handler.process_request(req)
File "/usr/lib/python2.6/dist-packages/trac/admin/web_ui.py", line 116, in process_request
  path_info)
File "build/bdist.linux-x86_64/egg/tracspamfilter/admin.py", line 381, in render_admin_panel
  'blogspam_methods': ", ".join(blogspam.getmethods()),

Suggested Fix

The following little patch should get rid of the problem.

Index: tracspamfilter/admin.py
===================================================================
--- tracspamfilter/admin.py	(revision 10886)
+++ tracspamfilter/admin.py	(working copy)
@@ -296,6 +296,7 @@
         typepad = TypePadFilterStrategy(self.env)
         akismet = AkismetFilterStrategy(self.env)
         stopforumspam = StopForumSpamFilterStrategy(self.env)
+        blogspam = BlogSpamFilterStrategy(self.env)
         defensio = 0
         if DefensioFilterStrategy:
             defensio = DefensioFilterStrategy(self.env)
@@ -351,7 +352,6 @@
             filtersys = FilterSystem(self.env)
             use_external = filtersys.use_external
             train_external = filtersys.train_external
-            blogspam = BlogSpamFilterStrategy(self.env)
             blogspam_api_url = blogspam.api_url
             blogspam_skip_tests = ",".join(blogspam.skip_tests)
             akismet_api_url = akismet.api_url

Attachments (0)

Change History (2)

comment:1 by Dirk Stöcker, 12 years ago

In r10887.

comment:2 by Dirk Stöcker, 12 years ago

Resolution: fixed
Status: newclosed

Modify Ticket

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