comparison MoinMoin/action/Despam.py @ 4570:e86a7b66eb0e

Despam: must use request.values because it also does GET requests, add logging/debug code
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Wed, 11 Feb 2009 02:38:25 +0100
parents 3caaa8c74c41
children 2c992293ece4
comparison
equal deleted inserted replaced
4569:3caaa8c74c41 4570:e86a7b66eb0e
9 """ 9 """
10 10
11 DAYS = 30 # we look for spam edits in the last x days 11 DAYS = 30 # we look for spam edits in the last x days
12 12
13 import time 13 import time
14
15 from MoinMoin import log
16 logging = log.getLogger(__name__)
14 17
15 from MoinMoin.logfile import editlog 18 from MoinMoin.logfile import editlog
16 from MoinMoin.util.dataset import TupleDataset, Column 19 from MoinMoin.util.dataset import TupleDataset, Column
17 from MoinMoin.widget.browser import DataBrowserWidget 20 from MoinMoin.widget.browser import DataBrowserWidget
18 from MoinMoin import wikiutil, Page, PageEditor 21 from MoinMoin import wikiutil, Page, PageEditor
180 # check for superuser 183 # check for superuser
181 if not request.user.isSuperUser(): 184 if not request.user.isSuperUser():
182 request.theme.add_msg(_('You are not allowed to use this action.'), "error") 185 request.theme.add_msg(_('You are not allowed to use this action.'), "error")
183 return Page.Page(request, pagename).send_page() 186 return Page.Page(request, pagename).send_page()
184 187
185 editor = request.form.get('editor') 188 editor = request.values.get('editor')
186 timestamp = time.time() - DAYS * 24 * 3600 189 timestamp = time.time() - DAYS * 24 * 3600
187 ok = request.form.get('ok', 0) 190 ok = request.form.get('ok', 0)
191 logging.debug("editor: %r ok: %r" % (editor, ok))
188 192
189 request.theme.send_title("Despam", pagename=pagename) 193 request.theme.send_title("Despam", pagename=pagename)
190 # Start content (important for RTL support) 194 # Start content (important for RTL support)
191 request.write(request.formatter.startContent("content")) 195 request.write(request.formatter.startContent("content"))
192 196