Description

When turning on wiki spam protection in wikiconfig.py, any attempt to save the page generates;

Steps to reproduce

  1. do this...
  2. I can't tell you how to reproduce as it's on a live wiki I dont want to leave broken.. but, when uncommenting the following line from wikiconfig.py

from MoinMoin.util.antispam import SecurityPolicy

from that point on any attempt to save a page generates the error above.

Example

I can't add URL as dont want live wiki to be broken.

Details

problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.

c:\python24\Lib\site-packages\MoinMoin\request.py in run (self=<MoinMoin.request.RequestCGI object>)

1135 from MoinMoin.wikiaction import getHandler
1136 handler = getHandler(self, action)
1137 handler(self.page.page_name, self)
1138
1139 # 5. Or redirect to another page
handler = <function do_edit> self = <MoinMoin.request.RequestCGI object> self.page = <MoinMoin.Page.Page instance> self.page.page_name = u'FrontPage'
c:\python24\Lib\site-packages\MoinMoin\wikiaction.py in do_edit (pagename=u'FrontPage', request=<MoinMoin.request.RequestCGI object>)

636 else:
637 try:
638 savemsg = pg.saveText(savetext, rev, trivial=trivial, comment=comment)
639 except pg.EditConflict, msg:
640 # Handle conflict and send editor
savemsg undefined pg = <MoinMoin.PageEditor.PageEditor instance> pg.saveText = <bound method PageEditor.saveText of <MoinMoin.PageEditor.PageEditor instance>> savetext = u'## Please edit system and help pages ONLY in the...iWikiWebFaq.\n\nThis wiki is powered by MoinMoin .\n' rev = 108 trivial = 0 comment = u''
c:\python24\Lib\site-packages\MoinMoin\PageEditor.py in saveText (self=<MoinMoin.PageEditor.PageEditor instance>, newtext=u'## Please edit system and help pages ONLY in the...iWikiWebFaq.\n\nThis wiki is powered by MoinMoin .\n', rev=108, **kw={'comment': u'', 'trivial': 0})

846
847 msg = ""
848 if not self.request.user.may.save(self, newtext, rev, **kw):
849 msg = _('You are not allowed to edit this page!')
850 raise self.AccessDenied, msg
self = <MoinMoin.PageEditor.PageEditor instance> self.request = <MoinMoin.request.RequestCGI object> self.request.user = <MoinMoin.user.User at 0x934328 name:u'MatthewWarren' id:1117315889.91.43814 valid:1> self.request.user.may = <MoinMoin.util.antispam.SecurityPolicy instance> self.request.user.may.save = <bound method SecurityPolicy.save of <MoinMoin.util.antispam.SecurityPolicy instance>> newtext = u'## Please edit system and help pages ONLY in the...iWikiWebFaq.\n\nThis wiki is powered by MoinMoin .\n' rev = 108 kw = {'comment': u'', 'trivial': 0}
c:\python24\Lib\site-packages\MoinMoin\util\antispam.py in save (self=<MoinMoin.util.antispam.SecurityPolicy instance>, editor=<MoinMoin.PageEditor.PageEditor instance>, newtext=u'## Please edit system and help pages ONLY in the...iWikiWebFaq.\n\nThis wiki is powered by MoinMoin .\n', rev=108, **kw={'comment': u'', 'trivial': 0})

166 for pn in BLACKLISTPAGES:
167 do_update = (pn != "LocalBadContent")
168 invalidate_cache_necessary, blacklist_entries = getblacklist(request, pn, do_update)
169 blacklist += blacklist_entries
170 invalidate_cache |= invalidate_cache_necessary
invalidate_cache_necessary undefined blacklist_entries undefined global getblacklist = <function getblacklist> request = <MoinMoin.request.RequestCGI object> pn = 'BadContent' do_update = True
c:\python24\Lib\site-packages\MoinMoin\util\antispam.py in getblacklist (request=<MoinMoin.request.RequestCGI object>, pagename='BadContent', do_update=True)

110 masterdate = response['lastModified']
111
112 if isinstance(masterdate, datetime.datetime):
113 # for python 2.5a
114 mydate = datetime.datetime(*tuple(time.gmtime(mymtime))[0:6])
builtin isinstance = <built-in function isinstance> masterdate = <DateTime u'20060504T20:39:51' at bf5968> global datetime = <module 'MoinMoin.util.datetime' from 'c:\Python24\lib\site-packages\MoinMoin\util\datetime.pyc'> datetime.datetime undefined
AttributeError
'module' object has no attribute 'datetime'

args = ("'module' object has no attribute 'datetime'",)
System Details
Date: Fri, 05 May 2006 10:50:03 +0000
Platform: win32 (nt)
Python: Python 2.4.2 (C:\Python24\python.exe)
MoinMoin: Release 1.5.3 (release)

MoinMoin Version

OS and Version

Python Version

Server Setup

Server Details

Workaround

Discussion

This is not a bug, just a file leftover from your previous moin install.

Just remove datetime.py* from MoinMoin/util/.

Plan


CategoryMoinMoinNoBug

MoinMoin: MoinMoinBugs/TurnOnSpamProtectionGetModuleError (last edited 2007-10-29 19:13:25 by localhost)