Edgewall Software
Modify

Opened 18 years ago

Closed 18 years ago

#4611 closed defect (fixed)

TracSpamFilter doesn't get Author or Content with 0.11dev

Reported by: johann@… Owned by: Matthew Good
Priority: normal Milestone: not applicable
Component: plugin/spamfilter Version: devel
Severity: normal Keywords: needinfo
Cc: johann@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

When I go to /admin/spamfilter/monitor, I get a Traceback if the Author is None.

The attached patch fixes the problem.

Change History (9)

comment:1 by johann@…, 18 years ago

The problem seems to be a symptom of a greater bug, maybe because I'm trying to use tracspamfilter with Trac 0.11dev r4612 and PostgreSQL as the database.

In the spamfilter_log table, the content is always "" (empty string) and the author is always NULL.

The headers are there (including Cookie: Host: Accept: etc). The columns authenticated, rejected, karma have reasonable values (mostly 0). The reasons column has appropriate data too. Path is always '/newticket' because that's where I tested it.

comment:2 by johann@…, 18 years ago

The problem persists after upgrade to r4665.

comment:3 by johann@…, 18 years ago

Summary: len(None) in tracspamfilter/templates/admin_spammonitor.htmlTracSpamFilter doesn't get Author or Content with 0.11dev

Also, the BadContent filter fails to work because the content is empty, but the Session filter works: sometimes a session is detected (with +3 karma).

The problem seems to be in the adapter that gets the content from Trac before filtering, not in the "INSERT INTO spamfilter_log" database SQL statement.

Therefore I assume it's not because of PostgreSQL but because of Trac 0.11dev.

comment:4 by Christian Boos, 18 years ago

Keywords: needinfo added
Milestone: none

Can you be more precise about the kind of data you were entering or the steps needed to reproduce the problem?

comment:5 by johann@…, 18 years ago

Steps to reproduce the problem:

  • Install Trac 0.11dev from Subversion
  • Install Spam-Filter from Subversion as Egg in Trac environment (setup.py bdist_egg)
  • Use sqlite or postgresql for database
  • Run with tracd or Apache2 and mod_python
  • Post a new ticket as anonymous (not logged in)
  • Posting works, display gives a traceback (TypeError: len() of unsized object)
  • In the database, the columns "author" and "content" will be empty.
SQLite version 2.8.17
Enter ".help" for instructions
sqlite> .headers ON
sqlite> select * from spamfilter_log;
id|time|path|author|authenticated|ipnr|headers|content|rejected|karma|reasons
1|1173478311|/newticket||0|127.0.0.1|Authorization: Digest username="johann", realm="vcards", nonce="9866fa4003e0d122ca6ae5d33c282c46", uri="/vcards/newticket", response="ba40978c7f17814deb53c9cea21b264e", qop=auth, nc=00000029, cnonce="4e3baaaad7c1e4e7"
Referer: http://localhost:8000/vcards/newticket
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.2) Gecko/20060601 Firefox/2.0.0.2 (Ubuntu-edgy)
Connection: keep-alive
Cookie: trac_form_token=70477daa2391e69de6953877; trac_session=24ebb17b7286d4bef4e4e73d; sessionid=de63b3e338d09b60c1b4d651a8685a45
Host: localhost:8000
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.8,de-de;q=0.5,de;q=0.3
Accept-Encoding: gzip,deflate
Keep-Alive: 300||0|0|

I did this today, on a fresh system, using the following versions:

comment:6 by johann@…, 18 years ago

To be exact, in the database the author is NULL and the content is '' (empty string).

comment:7 by johann@…, 18 years ago

The traceback that I mentioned above occurs in /admin/spamfilter/monitor and not on the regular ticket display.

The reason for the traceback is apparently that author is None, and len(None) gives a TypeError. My patch was trying to work around that, but it fixes only the symptom.

comment:8 by Matthew Good, 18 years ago

Resolution: fixed
Status: newclosed

This was fixed in r4982. I've applied the changes from the patch, and fixed the reading of the old and new ticket values since the input names in the request changed in 0.11dev.

Modify Ticket

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