Skip to content

comment_utils 0.3

Published on: November 11, 2007    Categories: Django

Since it’s Sunday and nobody’s reading right now, I’ll sneak in a release announcement instead of a pure “Django tip”: I’ve just released version 0.3 of comment_utils.

I’ve been running it for a little while, and it seems to be fine; if you run into any problems, please file a bug report.

Fixes and tweaks

Two big changes in this version are Unicode support and accommodations for a new method of template variable resolution.

As I wrote yesterday, Django’s Unicode merge means that anything which talks to external web-based APIs needs to account for the fact that you can’t really dump a Python Unicode string over the wire; version 0.3 of comment_utils uses the workaround I described to ensure that Unicode comments go cleanly to Akismet (if you’ve successfully posted a comment here any time since the redesign, you’re living proof that it works).

And a little while back, Django’s template system gained a new (and more efficient) method of resolving variables inside tags, via the new class django.template.Variable. Django’s own built-in tags were updated to use this, and comment_utils subclasses some of the built-in tags in django.contrib.comments, so an update was needed to make that work again.

New features

The only major new feature in this release is a script — comment_utils/bin/delete_spam_comments.py — which is intended to run as a cron job, and which cleans out non-public comments in your database. I get a huge number of spam comments, so regularly cleaning them out makes it a lot easier for me to manage the comments I actually care about; delete_spam_comments.py is a pretty simple standalone script (using optparse, as documented in a previous tip) to accept a settings module and various runtime parameters on the command line. By default, it deletes any non-public comment more than 14 days old.

Going forward

There are a few other features I’d like to add, but which involve fiddling with the admin and other tricks which may change with developments leading up to the 1.0 release, so for the time being I think comment_utils is going to be feature-frozen; I’ll still support it and fix any bugs, but until newforms-admin (and a possible rewrite of the comments app) land in Django trunk, I think I’m going to leave the feature set as-is.