Edgewall Software

Ticket #4611 (closed defect: fixed)

Opened 22 months ago

Last modified 21 months ago

TracSpamFilter doesn't get Author or Content with 0.11dev

Reported by: johann@… Owned by: mgood
Priority: normal Milestone: not applicable
Component: plugin/spamfilter Version: devel
Severity: normal Keywords: needinfo
Cc: johann@…

Description

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

The attached patch fixes the problem.

Attachments

Change History

Changed 22 months ago by johann@…

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.

Changed 22 months ago by johann@…

The problem persists after upgrade to r4665.

Changed 22 months ago by johann@…

  • summary changed from len(None) in tracspamfilter/templates/admin_spammonitor.html to TracSpamFilter 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.

Changed 21 months ago by cboos

  • keywords needinfo added
  • milestone set to none

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

Changed 21 months ago by johann@…

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:

Changed 21 months ago by johann@…

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

Changed 21 months ago by johann@…

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.

Changed 21 months ago by mgood

  • status changed from new to closed
  • resolution set to fixed

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.

Add/Change #4611 (TracSpamFilter doesn't get Author or Content with 0.11dev)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from mgood. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.