Re: Simple Comment Spam Reducing Plugin.

will guaraldi <[email protected]>
Newsgroups gmane.comp.web.pyblosxom.user
Message-ID <[email protected]>
I added this to the contributed plugins repository.

I haven't put the plugin on the site yet, though.  Getting there....

/will


On Sat, 5 Aug 2006, Blake Winton wrote:
> 
> Because my server's fan is making a funny noise, I bought a new Mac 
> Mini, which caused me to upgraded my copy of PyBlosxom to 1.3.2, and 
> thus lose most of my changes to the plugins.
>
> Specifically, I added in some code to prevent comments on entries from 
> more than 28 days ago.  Since there is a nice new comment api now, I 
> decided to rewrite my code as a separate plugin, in the hopes that 
> other's of you could use it.  And so I'll add it at the end of this 
> message.  If there are any comments, questions, or suggestions, I'ld be 
> happy to answer them.  I also hereby release the following code into the 
> Public Domain, so if anyone wants to clean it up, and put it in a 
> registry, or something, feel free to.
>
> ------>8 Cut here for noOldComments.py 8<------
> """
> This plugin is designed to prevent comments on entries older than
> 28 days, as a simple measure to stop 90% of the spam I get.
>
> This code is released into the Public Domain
> """
> __author__      = "Blake Winton <[email protected]>"
> __version__     = "1.0 - August 5th, 2006."
> __url__         = "http://example.com/"
> __description__ = "Prevent comments on entries older than a month."
>
> import sys
> import time
>
> def verify_installation(request):
>    return 1
>
>
> def cb_comment_reject(args):
>    req = args["request"]
>    comment = args["comment"]
>    blog_config = req.getConfiguration()
>    data = req.getData()
>    entry = data['entry_list'][0]
>    print >> sys.stderr, entry['mtime']
>    print >> sys.stderr, comment
>    if ( (time.time() - entry['mtime']) >= 2419200):
>        print >> sys.stderr, "Too old!"
>        return 1
>    print >> sys.stderr, "Just right!"
>    return 0
> ------>8 Stop cutting here for noOldComments.py 8<------
>
> Later,
> Blake.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.