Spam crossed the mail boundary some time ago. It's now everywhere. Akismet is a service with a simple API to check whether a comment, or trackback or what ever is either spammy or hammy.
Akismet is a Word Press plugin, but the API has been implemented in python, ruby and java. And one needs a Word Press key to actually use it.
Akizmet is a zope product, tested on Zope-2.8.5, using Five (hopefully correctly :P), and akismet.py.
Installing Akizmet is like installing any other zope product. Untar in INSTANCE_HOME/Products (or your products directory) and restart zope.
For this example, we're going to try and check for spamminess for core blog comments. (I think akizmet can be used in forums, guestbooks, etc; where user feedback is wanted.)
Instantiate an Akizmet in coreblog. name it myk . It requires the word press key and blog url.
Now, we have to short circuit the addComment. Add a Script (Python) with id kizmet_addComment with the following contents:
1 from DateTime import DateTime 2 ts=DateTime().millis() 3 kismet = context.myk 4 r=context.REQUEST 5 res = kismet.akizmet_comment_check(r) 6 if not res: 7 context.addComment(title=r.form['title'], author=r.form['author'], body=r.form['body'], url=r.form['url'],email=r.form['email'], REQUEST=r) 8 else: 9 kismet.addAkizmetItem(id=str(ts),title='',REQUEST=r) 10 r.RESPONSE.redirect('/somewhere')
What the script does is this:
- line 3 will get the akizmet instance
- line 5 will check the comments posted for spamminess
- line 6 will check for non spam, and call coreblog's real action (addComment)
- line 8 if the comments fail the test, we'll add it to our akizmet instance, for verification and submission (as spam or ham) to akismet service.
There should be a better way of doing this, but that's one easy way I could think of. If you have other ideas or implementation, please inform the rest of us.
It'd be even better if we can just have the short circuit script as one of the Akizmet methods. Ideas?
The product is in use here, and for the time being works. Sometimes akismet does miss and I think we need to train akismet more for effective use; that's why there's a form for us to submit to akismet (the service).
The product is still beta, ymmv, zpl, yadda yadda. Please comment and send bugs or ideas.
Trackback is http://myzope.kedai.com.my/blogs/kedai/61/tbping