Opened 7 years ago

Last modified 2 weeks ago

#7309 new enhancement

RFE: TracCaptchaPlugin support.

Reported by: royger@… Owned by:
Priority: normal Component: DiscussionPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.12


When I try to create a discussion using the plugin I get the following error:

How to Reproduce

While doing a POST operation on /discussion/forum/1, Trac issued an internal error.

(please provide additional details here)

Request parameters:

{'__FORM_TOKEN': u'2b983556e38e2d3f55c5cc58',
 'author': u'anonymous',
 'body': u'...',
 'discussion_action': u'post-add',
 'forum': u'1',
 'subject': u'',
 'submit': u'Submit',
 'subscribers': u''}

User agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; es-ES; rv: Gecko/2010031218 Firefox/3.0.19

System Information

System information not available

Enabled Plugins

Plugin information not available

Python Traceback

Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/Trac-0.12-py2.6.egg/trac/web/", line 513, in _dispatch_request
  File "/usr/lib/python2.6/site-packages/Trac-0.12-py2.6.egg/trac/web/", line 235, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/lib/python2.6/site-packages/TracDiscussion-0.7-py2.6.egg/tracdiscussion/", line 108, in process_request
    template, data = api.process_discussion(context)
  File "/usr/lib/python2.6/site-packages/TracDiscussion-0.7-py2.6.egg/tracdiscussion/", line 245, in process_discussion
    self._do_actions(context, actions)
  File "/usr/lib/python2.6/site-packages/TracDiscussion-0.7-py2.6.egg/tracdiscussion/", line 950, in _do_actions
    context, topic)
  File "/usr/lib/python2.6/site-packages/TracDiscussion-0.7-py2.6.egg/tracdiscussion/", line 25, in filter_topic
TypeError: test() takes exactly 5 arguments (4 given)

I'm using Trac 0.12, TracDiscussion 0.7 and TracSpamFilter 0.3.2dev-r9922.

Attachments (1)

filtersystem_5args.patch (1.2 KB) - added by Michael Henke 7 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 7 years ago by Radek Bartoň

Status: newassigned

OK, thanks for reporting. I'll take a look at it lately.

comment:2 Changed 7 years ago by sam@…

I've just been having a look at this, and to fix it on our installation, I've made the following changed to ''

# -*- coding: utf-8 -*-

# Trac includes.

# Spamfilter includes.
from tracspamfilter.api import FilterSystem, RejectContent

# Local includes.
from tracdiscussion.api import *

class DiscussionSpamFilter(Component):
        The spam filtering component implements adapter for SpamFilterPluging
        which denies to create topics of messages with bad content.

    # IDiscussionFilter methods.

    def filter_topic(self, context, topic):
        # Test topic for spam.
        #    FilterSystem(self.env).test(context.req, topic['author'], [(None,
        #      topic['author']), (None, topic['subject']), (None,
        #      topic['body'])])
        #except RejectContent, error:
            # Topic contains spam.
        #    return (False, error.message)

        # Topic is fine.
        return (True, topic)

    def filter_message(self, context, message):
        # Test message for spam.
        #    FilterSystem(self.env).test(context.req, message['author'], [(None,
        #      message['author']), (None, message['body'])])
        #except RejectContent, error:
            # Message contains spam.
        #    return (False, error.message)

        # Message is fine.
        return (True, message)

It completely disabled the Spam Filter.

Would it be possible to support reCAPTCHA as an alternative via TracCaptcha?

comment:3 Changed 7 years ago by Radek Bartoň

Summary: TypeError: test() takes exactly 5 arguments (4 given)RFE: TracCaptchaPlugin support.
Type: defectenhancement

I tested it with SpamFilterPlugin r9968 and it works fine. FilterSystem.test() takes 3 + 1 (self) arguments so you have to have installed some custom modifications of the plugin?

I'm changing the ticket to the request for TracCaptchaPlugin plugin support instead of closing it as worksforme.

comment:4 Changed 7 years ago by Michael Henke

I have the same problem like sam. The patch to solve the problem is attached

Changed 7 years ago by Michael Henke

Attachment: filtersystem_5args.patch added

comment:5 Changed 7 years ago by Radek Bartoň

What revision of SpamFilterPlugin do you use? URL to the repository would be the best.

comment:6 Changed 7 years ago by Michael Henke

I use the current revision My tracspamfilter/ is revision 9893

comment:7 Changed 7 years ago by anonymous

OK, thanks. I didn't know that this fork exists. I'm still using .

comment:8 in reply to:  2 Changed 7 years ago by Felix Schwarz

Replying to

Would it be possible to support reCAPTCHA as an alternative via TracCaptcha

Just wanted to mention that TracCaptcha supports the DiscussionPlugin. But then, actually that's not what this bug report is about so please forgive my spamming :-P

comment:9 Changed 6 years ago by Oliver Metz

Attached patch solved the problem for me, too. Working with trac-0.12 (stable branch) and spamfilter plugin from here.

comment:10 Changed 2 weeks ago by Ryan J Ollos

Owner: Radek Bartoň deleted
Status: assignednew

Modify Ticket

Change Properties
Set your email in Preferences
as new The ticket will remain with no owner.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.