changeset 477:4e85cddd2db4

fixed antispam for python 2.5a xmlrpclib imported from: moin--main--1.5--patch-481
author Thomas Waldmann <tw@waldmann-edv.de>
date Sat, 18 Mar 2006 12:05:33 +0000
parents 4be11eec9c4f
children ce2e934557f4
files ChangeLog MoinMoin/util/antispam.py
diffstat 2 files changed, 24 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Mar 18 11:56:51 2006 +0000
+++ b/ChangeLog	Sat Mar 18 12:05:33 2006 +0000
@@ -2,6 +2,20 @@
 # arch-tag: automatic-ChangeLog--arch@arch.thinkmo.de--2003-archives/moin--main--1.5
 #
 
+2006-03-18 13:05:33 GMT	Thomas Waldmann <tw@waldmann-edv.de>	patch-481
+
+    Summary:
+      fixed antispam for python 2.5a xmlrpclib
+    Revision:
+      moin--main--1.5--patch-481
+
+    fixed antispam for python 2.5a xmlrpclib
+    
+
+    modified files:
+     ChangeLog MoinMoin/util/antispam.py
+
+
 2006-03-18 12:56:51 GMT	Thomas Waldmann <tw@waldmann-edv.de>	patch-480
 
     Summary:
--- a/MoinMoin/util/antispam.py	Sat Mar 18 11:56:51 2006 +0000
+++ b/MoinMoin/util/antispam.py	Sat Mar 18 12:05:33 2006 +0000
@@ -13,7 +13,7 @@
 # give some log entries to stderr
 debug = 1
 
-import re, sys, time
+import re, sys, time, datetime
 import sets
 
 if __name__ == '__main__':
@@ -108,7 +108,14 @@
                 
                 # Compare date against local BadContent copy
                 masterdate = response['lastModified']
-                mydate = xmlrpclib.DateTime(tuple(time.gmtime(mymtime)))
+
+                if isinstance(masterdate, datetime.datetime): 
+                    # for python 2.5a
+                    mydate = datetime.datetime(*tuple(time.gmtime(mymtime))[0:6])
+                else:
+                    # for python <= 2.4.x
+                    mydate = xmlrpclib.DateTime(tuple(time.gmtime(mymtime)))
+                                                    
                 dprint("master: %s mine: %s" % (masterdate, mydate))
                 if mydate < masterdate:
                     # Get new copy and save
@@ -210,7 +217,7 @@
     """
     import urllib
     mtbl = urllib.urlopen("http://www.jayallen.org/comment_spam/blacklist.txt").read()
-    mmbl = urllib.urlopen("http://moinmaster.wikiwikiweb.de:8000/BadContent?action=raw").read()
+    mmbl = urllib.urlopen("http://moinmaster.wikiwikiweb.de/BadContent?action=raw").read()
     mtbl = makelist(mtbl)
     mmbl = makelist(mmbl)
     print "#format plain"