Small patch for no_old_comments.py plugin
Martijn van de Streek <[email protected]>
| Newsgroups | gmane.comp.web.pyblosxom.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello, I've made a small patch for no_old_comments.py, to make the maximum age of a post configurable (using the 'no_old_comments_max_age' config option). It also sanitizes logging to using Logger. Please apply this for the next version. Martijn -- Sorry isn't an excuse when you do something stupid on purpose. ------------------------------------------------------------------------- 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 _______________________________________________ Pyblosxom-devel mailing list Pyblosxom-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/pyblosxom-devel
no_old_comments.diff
(text/plain, 990 B)
--- contrib/plugins/comments/plugins/no_old_comments.py 2006-09-27 18:36:10.000000000 +0200
+++ ../plugins/no_old_comments.py 2006-11-22 16:28:38.000000000 +0100
@@ -27,6 +27,7 @@
import sys
import time
+from Pyblosxom import tools
def verify_installation(request):
return 1
@@ -35,12 +36,19 @@
req = args["request"]
comment = args["comment"]
blog_config = req.getConfiguration()
+
+ max_age = blog_config.get('no_old_comments_max_age', 2419200)
+
data = req.getData()
entry = data['entry_list'][0]
- print >> sys.stderr, entry['mtime']
- print >> sys.stderr, comment
+
+ logger = tools.getLogger()
+
+ logger.debug( '%s -> %s' % (entry['mtime'], comment) )
+
if ( (time.time() - entry['mtime']) >= 2419200):
- print >> sys.stderr, "Too old!"
+ logger.info('Entry too old, comment not posted!')
return 1
- print >> sys.stderr, "Just right!"
+
+ logger.info('Entry ok, comment posted!')
return 0