Skip to content. | Skip to navigation

Sections
Personal tools
What is this?
Hi, my name is Tom Lazar and I'm a Plone and Zope developer based in Berlin, Germany and this is my personal and professional (no big difference, really...) website.
 

Commentspam [update]

Filed Under:

Well, the the spam-bot has stopped, but every now and then I get a single comment spam. I'd really hate to turn off comments (and COREBlog doesn't really have any features to deal with comment spam such as Moveable Type or Wordpress).

So, while I'm still waiting for Quills to reach a stable state (then I could, for instance, limit comments to registered users) I've made a small but very useful tweak to my comment notification script: I've simply added a direct link to the comment management tab. Now, if somebody posts spam it takes me two clicks with the mouse to delete it ;-)

Here's the line I modified:

[Manage ] http://tomster.org/blog/%s/manage_comments

You can find the entire script for your convenience in the extended section of this entry.

try:
    mailhost=getattr(context, \
        context.superValues('Mail Host')[0].id)

except:
    raise AttributeError, "Mail Host object cant be found."
 
to_addr   = "tom@tomster.org"
from_addr = "coreblog@tomster.org"
 
mMsg = """To: %s
From: %s
Mime-Version: 1.0
Content-Type: text/plain;
 
Body:
[Author]  %s
[Title]   %s
[URL]     %s
[Manage ] http://tomster.org/blog/%s/manage_comments
%s""" % (to_addr , from_addr ,  d["author"] , d["title"] ,\
         d["url"] , str(d["parent_id"]), d["body"])
 
mTo = to_addr
mFrom = from_addr
mSubj = '[tomster.blog] Comment {%s}' % (d["title"])
 
mailhost.send(mMsg, mTo, mFrom, mSubj)