Plugin to block one-word comments
Michael Olson <mwolson-mXXj517/[email protected]>
| Newsgroups | gmane.comp.web.pyblosxom.user |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Here's a plugin that I made to stop one-word comments. This is meant
to be used in conjunction with akismet, for it stops the main sort of
comment that gets by akismet.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFGKuAS+1Ho2POo0xkRAhdaAJ9d5emLeWXkjd+Ofu3efyYfbNJWHACfSirP
ieheuAGaNfd41+PBFo50TSo=
=RcrM
-----END PGP SIGNATURE-----
--
Michael Olson -- FSF Associate Member #652 -- http://www.mwolson.org/
Interests: Lisp, text markup, protocols -- Jabber: mwolson_at_hcoop.net
/` |\ | | | Projects: Emacs, Muse, ERC, EMMS, Planner, ErBot, DVC
|_] | \| |_| Reclaim your digital rights by eliminating DRM.
See http://www.defectivebydesign.org/what_is_drm for details.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
pyblosxom-users mailing list
pyblosxom-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/pyblosxom-users
onewordcomments.py
(text/x-python, 1.6 KB)
# Copyright (C) 2007 Michael Olson <mwolson-mXXj517/[email protected]> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 # USA """ Reject comments that are only one word. """ __author__ = "Michael Olson" __version__ = "0.1" __url__ = "http://mwolson.org/blog/" __description__ = "Reject one-word comments." import sys import time def verify_installation(request): return True def cb_comment_reject(args): request = args['request'] form = request.getForm() if not form.has_key('body'): print >>sys.stderr, 'Rejected empty comment.', return (True, 'Rejected empty comment.') comment = form['body'].value if not comment: print 'Rejected empty comment.', return (True, 'Rejected empty comment.') for char in list(comment): if char == ' ': return False print 'Rejected one-word comment.', return (True, 'Rejected one-word comment.') # handle one-word trackback spam as well cb_trackback_reject = cb_comment_reject