add a spam-filter callback facility to comments
|Reported by:||hugo||Owned by:||Adrian Holovaty|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The comment system currently doesn't provide any way to make use of the is_public and approved flags - but I think they could be used for good. For example an approved comment could be shown with active links, while an unapproved one would be shown without active links. And a is_public=False one wouldn't be shown at all. This could be managed manually by the admin in the Django admin interface, but I think that's cumbersome for sites with heavy comment traffic (or with a heavy comment-spam problem!). So I think there should be something like
COMMENT_SPAM_FILTERS = ( 'django.contrib.spamfilters.count_links', )
in the settings that would allow users to hook up several filters that are run on free comments before they hit the database. The sample one would just use the number of links in the comment to decide wether it might be spam or not. There could be others that do other checks on comment data and request data. Those filters would need to get the request object passed in, so they can look at headers (as those are often a giveaway on spammers).
Sure, an alternative would be to switch to a registered comment system, but not everybody likes that. Free comments are a nice and uncomplicated way, but we already know for sure that free comments will sooner or later be hit by comment spam, so we should at least provide the infrastructure to hook up spam filters.