changeset 4201:40acd13fb3d6

Changed form access to MultiDict forms
author Florian Krupicka <florian.krupicka@googlemail.com>
date Thu, 03 Jul 2008 23:36:48 +0200
parents c21991eed9c9
children 7e43fdd2d2c0
files MoinMoin/action/AttachFile.py MoinMoin/action/CopyPage.py MoinMoin/action/DeletePage.py MoinMoin/action/Despam.py MoinMoin/action/Load.py MoinMoin/action/PackagePages.py MoinMoin/action/RenamePage.py MoinMoin/action/SpellCheck.py MoinMoin/action/SubscribeUser.py MoinMoin/action/SyncPages.py MoinMoin/action/__init__.py MoinMoin/action/backup.py MoinMoin/action/bookmark.py MoinMoin/action/chart.py MoinMoin/action/diff.py MoinMoin/action/edit.py MoinMoin/action/fckdialog.py MoinMoin/action/fullsearch.py MoinMoin/action/info.py MoinMoin/action/links.py MoinMoin/action/login.py MoinMoin/action/newpage.py MoinMoin/action/recoverpass.py MoinMoin/action/refresh.py MoinMoin/action/revert.py MoinMoin/action/rss_rc.py MoinMoin/action/serveopenid.py MoinMoin/action/sitemap.py MoinMoin/action/titleindex.py MoinMoin/action/userprefs.py MoinMoin/action/userprofile.py
diffstat 31 files changed, 127 insertions(+), 130 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/AttachFile.py	Wed Jul 02 18:50:37 2008 +0200
+++ b/MoinMoin/action/AttachFile.py	Thu Jul 03 23:36:48 2008 +0200
@@ -251,10 +251,10 @@
     _ = request.getText
 
     error = None
-    if not request.form.get('target', [''])[0]:
+    if not request.form.get('target'):
         error = _("Filename of attachment not specified!")
     else:
-        filename = wikiutil.taintfilename(request.form['target'][0])
+        filename = wikiutil.taintfilename(request.form['target'])
         fpath = getFilename(request, pagename, filename)
 
         if os.path.isfile(fpath):
@@ -420,14 +420,14 @@
 
     now = time.time()
     pubpath = request.cfg.url_prefix_static + "/applets/TWikiDrawPlugin"
-    basename = request.form['drawing'][0]
+    basename = request.form['drawing']
     drawpath = getAttachUrl(pagename, basename + '.draw', request, escaped=1)
     pngpath = getAttachUrl(pagename, basename + '.png', request, escaped=1)
     pagelink = attachUrl(request, pagename, '', action=action_name, ts=now)
     helplink = Page(request, "HelpOnActions/AttachFile").url(request)
     savelink = attachUrl(request, pagename, '', action=action_name, do='savedrawing')
     #savelink = Page(request, pagename).url(request) # XXX include target filename param here for twisted
-                                           # request, {'savename': request.form['drawing'][0]+'.draw'}
+                                           # request, {'savename': request.form['drawing']+'.draw'}
     #savelink = '/cgi-bin/dumpform.bat'
 
     timestamp = '&amp;ts=%s' % now
@@ -494,9 +494,9 @@
     'action_name': action_name,
     'upload_label_file': _('File to upload'),
     'upload_label_rename': _('Rename to'),
-    'rename': request.form.get('rename', [''])[0],
+    'rename': request.form.get('rename', ''),
     'upload_label_overwrite': _('Overwrite existing attachment of same name'),
-    'overwrite_checked': ('', 'checked')[request.form.get('overwrite', ['0'])[0] == '1'],
+    'overwrite_checked': ('', 'checked')[request.form.get('overwrite', '0') == '1'],
     'upload_button': _('Upload'),
     'textcha': TextCha(request).render(),
 })
@@ -507,7 +507,7 @@
     if not writeable:
         request.write('<p>%s</p>' % _('You are not allowed to attach a file to this page.'))
 
-    if writeable and request.form.get('drawing', [None])[0]:
+    if writeable and request.form.get('drawing'):
         send_hotdraw(pagename, request)
 
 
@@ -519,8 +519,8 @@
     """ Main dispatcher for the 'AttachFile' action. """
     _ = request.getText
 
-    do = request.form.get('do', ['upload_form'])
-    handler = globals().get('_do_%s' % do[0])
+    do = request.form.get('do', 'upload_form')
+    handler = globals().get('_do_%s' % do)
     if handler:
         msg = handler(pagename, request)
     else:
@@ -566,7 +566,7 @@
         return _('TextCha: Wrong answer! Go back and try again...')
 
     form = request.form
-    overwrite = form.get('overwrite', [u'0'])[0]
+    overwrite = form.get('overwrite', u'0')
     try:
         overwrite = int(overwrite)
     except:
@@ -579,7 +579,7 @@
         return _('You are not allowed to overwrite a file attachment of this page.')
 
     filename = form.get('file__filename__')
-    rename = form.get('rename', [u''])[0].strip()
+    rename = form.get('rename', u'').strip()
     if rename:
         target = rename
     else:
@@ -592,7 +592,7 @@
         return _("Filename of attachment not specified!")
 
     # get file content
-    filecontent = request.form.get('file', [None])[0]
+    filecontent = request.form.get('file')
     if filecontent is None:
         # This might happen when trying to upload file names
         # with non-ascii characters on Safari.
@@ -618,8 +618,8 @@
     if not request.user.may.write(pagename):
         return _('You are not allowed to save a drawing on this page.')
 
-    filename = request.form['filename'][0]
-    filecontent = request.form['filepath'][0]
+    filename = request.form['filename']
+    filecontent = request.form['filepath']
 
     basepath, basename = os.path.split(filename)
     basename, ext = os.path.splitext(basename)
@@ -720,17 +720,17 @@
 
     if 'cancel' in request.form:
         return _('Move aborted!')
-    if not wikiutil.checkTicket(request, request.form['ticket'][0]):
+    if not wikiutil.checkTicket(request, request.form['ticket']):
         return _('Please use the interactive user interface to move attachments!')
     if not request.user.may.delete(pagename):
         return _('You are not allowed to move attachments from this page.')
 
     if 'newpagename' in request.form:
-        new_pagename = request.form.get('newpagename')[0]
+        new_pagename = request.form.get('newpagename')
     else:
         upload_form(pagename, request, msg=_("Move aborted because new page name is empty."))
     if 'newattachmentname' in request.form:
-        new_attachment = request.form.get('newattachmentname')[0]
+        new_attachment = request.form.get('newattachmentname')
         if new_attachment != wikiutil.taintfilename(new_attachment):
             upload_form(pagename, request, msg=_("Please use a valid filename for attachment '%(filename)s'.") % {
                                   'filename': new_attachment})
@@ -738,7 +738,7 @@
     else:
         upload_form(pagename, request, msg=_("Move aborted because new attachment name is empty."))
 
-    attachment = request.form.get('oldattachmentname')[0]
+    attachment = request.form.get('oldattachmentname')
     move_file(request, pagename, new_pagename, attachment, new_attachment)
 
 
--- a/MoinMoin/action/CopyPage.py	Wed Jul 02 18:50:37 2008 +0200
+++ b/MoinMoin/action/CopyPage.py	Thu Jul 03 23:36:48 2008 +0200
@@ -46,20 +46,19 @@
         """ copy this page to "pagename" """
         _ = self._
         form = self.form
-        newpagename = form.get('newpagename', [u''])[0]
+        newpagename = form.get('newpagename', u'')
         newpagename = wikiutil.normalize_pagename(newpagename, self.cfg)
-        comment = form.get('comment', [u''])[0]
+        comment = form.get('comment', u'')
         comment = wikiutil.clean_input(comment)
 
         self.page = PageEditor(self.request, self.pagename)
         success, msgs = self.page.copyPage(newpagename, comment)
 
         copy_subpages = 0
-        if form.has_key('copy_subpages'):
-            try:
-                copy_subpages = int(form['copy_subpages'][0])
-            except:
-                pass
+        try:
+            copy_subpages = int(form['copy_subpages'])
+        except:
+            pass
 
         if copy_subpages and self.subpages or (not self.users_subpages and self.subpages):
             for name in self.subpages:
@@ -86,7 +85,7 @@
 
             d = {
                 'subpage': subpages,
-                'subpages_checked': ('', 'checked')[self.request.form.get('subpages_checked', ['0'])[0] == '1'],
+                'subpages_checked': ('', 'checked')[self.request.form.get('subpages_checked', '0') == '1'],
                 'subpage_label': _('Copy all /subpages too?'),
                 'pagename': wikiutil.escape(self.pagename, True),
                 'newname_label': _("New name"),
--- a/MoinMoin/action/DeletePage.py	Wed Jul 02 18:50:37 2008 +0200
+++ b/MoinMoin/action/DeletePage.py	Thu Jul 03 23:36:48 2008 +0200
@@ -44,7 +44,7 @@
     def do_action(self):
         """ Delete pagename """
         form = self.form
-        comment = form.get('comment', [u''])[0]
+        comment = form.get('comment', u'')
         comment = wikiutil.clean_input(comment)
 
         # Create a page editor that does not do editor backups, because
@@ -53,11 +53,10 @@
         success, msgs = self.page.deletePage(comment)
 
         delete_subpages = 0
-        if 'delete_subpages' in form:
-            try:
-                delete_subpages = int(form['delete_subpages'][0])
-            except:
-                pass
+        try:
+            delete_subpages = int(form['delete_subpages'][0])
+        except:
+            pass
 
         if delete_subpages and self.subpages:
             for name in self.subpages:
@@ -75,7 +74,7 @@
 
             d = {
                 'subpage': subpages,
-                'subpages_checked': ('', 'checked')[self.request.form.get('subpages_checked', ['0'])[0] == '1'],
+                'subpages_checked': ('', 'checked')[self.request.form.get('subpages_checked', '0') == '1'],
                 'subpage_label': _('Delete all /subpages too?'),
                 'comment_label': _("Optional reason for the deletion"),
                 'buttons_html': buttons_html,
--- a/MoinMoin/action/Despam.py	Wed Jul 02 18:50:37 2008 +0200
+++ b/MoinMoin/action/Despam.py	Thu Jul 03 23:36:48 2008 +0200
@@ -183,9 +183,9 @@
         request.theme.add_msg(_('You are not allowed to use this action.'), "error")
         return Page.Page(request, pagename).send_page()
 
-    editor = request.form.get('editor', [None])[0]
+    editor = request.form.get('editor')
     timestamp = time.time() - DAYS * 24 * 3600
-    ok = request.form.get('ok', [0])[0]
+    ok = request.form.get('ok', 0)
 
     request.theme.send_title("Despam", pagename=pagename)
     # Start content (important for RTL support)
--- a/MoinMoin/action/Load.py	Wed Jul 02 18:50:37 2008 +0200
+++ b/MoinMoin/action/Load.py	Thu Jul 03 23:36:48 2008 +0200
@@ -36,11 +36,11 @@
         form = self.form
         request = self.request
 
-        comment = form.get('comment', [u''])[0]
+        comment = form.get('comment', u'')
         comment = wikiutil.clean_input(comment)
 
         filename = form.get('file__filename__')
-        rename = form.get('rename', [''])[0].strip()
+        rename = form.get('rename', '').strip()
         if rename:
             target = rename
         else:
@@ -50,7 +50,7 @@
         target = wikiutil.clean_input(target)
 
         if target:
-            filecontent = form['file'][0]
+            filecontent = form['file']
             if hasattr(filecontent, 'read'): # a file-like object
                 filecontent = filecontent.read() # XXX reads complete file into memory!
             filecontent = wikiutil.decodeUnknownInput(filecontent)
--- a/MoinMoin/action/PackagePages.py	Wed Jul 02 18:50:37 2008 +0200
+++ b/MoinMoin/action/PackagePages.py	Thu Jul 03 23:36:48 2008 +0200
@@ -68,10 +68,10 @@
         form = self.request.form
 
         # Get new name from form and normalize.
-        pagelist = form.get('pagelist', [u''])[0]
-        packagename = form.get('packagename', [u''])[0]
+        pagelist = form.get('pagelist', u'')
+        packagename = form.get('packagename', u'')
 
-        if not form.get('submit', [None])[0]:
+        if not form.get('submit'):
             self.request.theme.add_msg(self.makeform(), "dialog")
             raise ActionError
 
--- a/MoinMoin/action/RenamePage.py	Wed Jul 02 18:50:37 2008 +0200
+++ b/MoinMoin/action/RenamePage.py	Thu Jul 03 23:36:48 2008 +0200
@@ -45,20 +45,19 @@
         """ Rename this page to "pagename" """
         _ = self._
         form = self.form
-        newpagename = form.get('newpagename', [u''])[0]
+        newpagename = form.get('newpagename', u'')
         newpagename = wikiutil.normalize_pagename(newpagename, self.cfg)
-        comment = form.get('comment', [u''])[0]
+        comment = form.get('comment', u'')
         comment = wikiutil.clean_input(comment)
 
         self.page = PageEditor(self.request, self.pagename)
         success, msgs = self.page.renamePage(newpagename, comment)
 
         rename_subpages = 0
-        if 'rename_subpages' in form:
-            try:
-                rename_subpages = int(form['rename_subpages'][0])
-            except:
-                pass
+        try:
+            rename_subpages = int(form['rename_subpages'])
+        except:
+            pass
 
         if rename_subpages and self.subpages:
             for name in self.subpages:
@@ -85,7 +84,7 @@
 
             d = {
                 'subpage': subpages,
-                'subpages_checked': ('', 'checked')[self.request.form.get('subpages_checked', ['0'])[0] == '1'],
+                'subpages_checked': ('', 'checked')[self.request.form.get('subpages_checked', '0') == '1'],
                 'subpage_label': _('Rename all /subpages too?'),
                 'pagename': wikiutil.escape(self.pagename, True),
                 'newname_label': _("New name"),
--- a/MoinMoin/action/SpellCheck.py	Wed Jul 02 18:50:37 2008 +0200
+++ b/MoinMoin/action/SpellCheck.py	Thu Jul 03 23:36:48 2008 +0200
@@ -102,7 +102,7 @@
     from MoinMoin.PageEditor import PageEditor
     # get the new words as a string (if any are marked at all)
     try:
-        newwords = request.form['newwords']
+        newwords = request.form.getlist('newwords')
     except KeyError:
         # no new words checked
         return
--- a/MoinMoin/action/SubscribeUser.py	Wed Jul 02 18:50:37 2008 +0200
+++ b/MoinMoin/action/SubscribeUser.py	Thu Jul 03 23:36:48 2008 +0200
@@ -37,7 +37,7 @@
     from MoinMoin.formatter.text_html import Formatter
     formatter = Formatter(request)
 
-    result = subscribe_users(request, request.form['users'][0].split(","), pagename, formatter)
+    result = subscribe_users(request, request.form['users'].split(","), pagename, formatter)
     request.write(result)
 
     request.theme.send_footer(pagename)
--- a/MoinMoin/action/SyncPages.py	Wed Jul 02 18:50:37 2008 +0200
+++ b/MoinMoin/action/SyncPages.py	Thu Jul 03 23:36:48 2008 +0200
@@ -118,7 +118,7 @@
         """ Does some fixup on the parameters. """
         # Load the password
         if "password" in self.request.form:
-            params["password"] = self.request.form["password"][0]
+            params["password"] = self.request.form["password"]
 
         # merge the pageList case into the pageMatch case
         if params["pageList"] is not None:
--- a/MoinMoin/action/__init__.py	Wed Jul 02 18:50:37 2008 +0200
+++ b/MoinMoin/action/__init__.py	Thu Jul 03 23:36:48 2008 +0200
@@ -90,7 +90,7 @@
             return True
         # Require a valid ticket. Make outside attacks harder by
         # requiring two full HTTP transactions
-        ticket = self.form.get('ticket', [''])[0]
+        ticket = self.form.get('ticket', '')
         return wikiutil.checkTicket(self.request, ticket)
 
     # UI ---------------------------------------------------------------------
@@ -264,7 +264,7 @@
         DEPRECATED: remove this action when we don't need it any more for compatibility.
     """
     if 'mimetype' not in request.form:
-        request.form['mimetype'] = [u"text/plain"]
+        request.form['mimetype'] = u"text/plain"
     do_show(pagename, request, count_hit=0, cacheable=0)
 
 def do_content(pagename, request):
@@ -285,10 +285,10 @@
 def do_refresh(pagename, request):
     """ Handle refresh action """
     # Without arguments, refresh action will refresh the page text_html cache.
-    arena = request.form.get('arena', ['Page.py'])[0]
+    arena = request.form.get('arena', 'Page.py')
     if arena == 'Page.py':
         arena = Page(request, pagename)
-    key = request.form.get('key', ['text_html'])[0]
+    key = request.form.get('key', 'text_html')
 
     # Remove cache entry (if exists), and send the page
     from MoinMoin import caching
@@ -298,7 +298,7 @@
 
 def do_goto(pagename, request):
     """ redirect to another page """
-    target = request.form.get('target', [''])[0]
+    target = request.form.get('target', '')
     request.http_redirect(Page(request, target).url(request))
 
 # Dispatching ----------------------------------------------------------------
--- a/MoinMoin/action/backup.py	Wed Jul 02 18:50:37 2008 +0200
+++ b/MoinMoin/action/backup.py	Thu Jul 03 23:36:48 2008 +0200
@@ -130,7 +130,7 @@
         return sendMsg(request, pagename,
                        msg=_('You are not allowed to do remote backup.'), msgtype="error")
 
-    dowhat = request.form.get('do', [None])[0]
+    dowhat = request.form.get('do')
     if dowhat == 'backup':
         sendBackup(request)
     elif dowhat == 'restore':
--- a/MoinMoin/action/bookmark.py	Wed Jul 02 18:50:37 2008 +0200
+++ b/MoinMoin/action/bookmark.py	Thu Jul 03 23:36:48 2008 +0200
@@ -19,7 +19,7 @@
         request.theme.add_msg(_("You must login to use this action: %(action)s.") % {"action": actname}, "error")
         return Page(request, pagename).send_page()
 
-    timestamp = request.form.get('time', [None])[0]
+    timestamp = request.form.get('time')
     if timestamp is not None:
         if timestamp == 'del':
             tm = None
--- a/MoinMoin/action/chart.py	Wed Jul 02 18:50:37 2008 +0200
+++ b/MoinMoin/action/chart.py	Thu Jul 03 23:36:48 2008 +0200
@@ -19,7 +19,7 @@
         request.theme.add_msg(_("Charts are not available!"), "error")
         return request.page.send_page()
 
-    chart_type = request.form.get('type', [''])[0].strip()
+    chart_type = request.form.get('type', '').strip()
     if not chart_type:
         request.theme.add_msg(_('You need to provide a chart type!'), "error")
         return request.page.send_page()
--- a/MoinMoin/action/diff.py	Wed Jul 02 18:50:37 2008 +0200
+++ b/MoinMoin/action/diff.py	Thu Jul 03 23:36:48 2008 +0200
@@ -21,7 +21,7 @@
         return
 
     try:
-        date = request.form['date'][0]
+        date = request.form['date']
         try:
             date = long(date) # must be long for py 2.2.x
         except StandardError:
@@ -30,11 +30,11 @@
         date = 0
 
     try:
-        rev1 = int(request.form.get('rev1', [-1])[0])
+        rev1 = int(request.form.get('rev1', -1))
     except StandardError:
         rev1 = 0
     try:
-        rev2 = int(request.form.get('rev2', [0])[0])
+        rev2 = int(request.form.get('rev2', 0))
     except StandardError:
         rev2 = 0
 
@@ -44,7 +44,7 @@
             rev1 = -1
 
     # spacing flag?
-    ignorews = int(request.form.get('ignorews', [0])[0])
+    ignorews = int(request.form.get('ignorews', 0))
 
     _ = request.getText
 
--- a/MoinMoin/action/edit.py	Wed Jul 02 18:50:37 2008 +0200
+++ b/MoinMoin/action/edit.py	Thu Jul 03 23:36:48 2008 +0200
@@ -33,7 +33,7 @@
     if editor not in valideditors:
         editor = request.cfg.editor_default
 
-    editorparam = request.form.get('editor', [editor])[0]
+    editorparam = request.form.get('editor', editor)
     if editorparam == "guipossible":
         lasteditor = editor
     elif editorparam == "textonly":
@@ -49,11 +49,11 @@
         editor = 'text'
 
     rev = request.rev or 0
-    savetext = request.form.get('savetext', [None])[0]
-    comment = request.form.get('comment', [u''])[0]
-    category = request.form.get('category', [None])[0]
-    rstrip = int(request.form.get('rstrip', ['0'])[0])
-    trivial = int(request.form.get('trivial', ['0'])[0])
+    savetext = request.form.get('savetext')
+    comment = request.form.get('comment', u'')
+    category = request.form.get('category')
+    rstrip = int(request.form.get('rstrip', '0'))
+    trivial = int(request.form.get('trivial', '0'))
 
     if 'button_switch' in request.form:
         if editor == 'text':
@@ -78,7 +78,7 @@
     cancelled = 'button_cancel' in request.form
 
     if request.cfg.edit_ticketing:
-        ticket = request.form.get('ticket', [''])[0]
+        ticket = request.form.get('ticket', '')
         if not wikiutil.checkTicket(request, ticket):
             request.theme.add_msg(_('Please use the interactive user interface to use action %(actionname)s!') % {'actionname': 'edit' }, "error")
             pg.send_page()
@@ -88,7 +88,7 @@
     try:
         if lasteditor == 'gui':
             # convert input from Graphical editor
-            format = request.form.get('format', ['wiki'])[0]
+            format = request.form.get('format', 'wiki')
             if format == 'wiki':
                 converter_name = 'text_html_text_moin_wiki'
             else:
--- a/MoinMoin/action/fckdialog.py	Wed Jul 02 18:50:37 2008 +0200
+++ b/MoinMoin/action/fckdialog.py	Thu Jul 03 23:36:48 2008 +0200
@@ -163,7 +163,7 @@
 
 def page_list(request):
     from MoinMoin import search
-    name = request.form.get("pagename", [""])[0]
+    name = request.form.get("pagename", "")
     if name:
         searchresult = search.searchPages(request, 't:"%s"' % name)
         pages = [p.page_name for p in searchresult.hits]
@@ -200,7 +200,7 @@
 
 def link_dialog(request):
     # list of wiki pages
-    name = request.form.get("pagename", [""])[0]
+    name = request.form.get("pagename", "")
     if name:
         from MoinMoin import search
         # XXX error handling!
@@ -365,7 +365,7 @@
 
 def attachment_dialog(request):
     # list of wiki pages
-    name = request.form.get("pagename", [""])[0]
+    name = request.form.get("pagename", "")
     if name:
         from MoinMoin import search
         # XXX error handling!
--- a/MoinMoin/action/fullsearch.py	Wed Jul 02 18:50:37 2008 +0200
+++ b/MoinMoin/action/fullsearch.py	Thu Jul 03 23:36:48 2008 +0200
@@ -27,7 +27,7 @@
         ret = -1 # spammer / bot
     else:
         try:
-            ret = int(form['titlesearch'][0])
+            ret = int(form['titlesearch'])
         except ValueError:
             ret = 1
         except KeyError:
@@ -37,7 +37,7 @@
 def isAdvancedSearch(request):
     """ Return True if advanced search is requested """
     try:
-        return int(request.form['advancedsearch'][0])
+        return int(request.form['advancedsearch'])
     except KeyError:
         return False
 
@@ -72,32 +72,32 @@
     elif advancedsearch:
         context = 180 # XXX: hardcoded context count for advancedsearch
     else:
-        context = int(request.form.get('context', [0])[0])
+        context = int(request.form.get('context', 0))
 
     # Get other form parameters
-    needle = request.form.get(fieldname, [''])[0]
-    case = int(request.form.get('case', [0])[0])
-    regex = int(request.form.get('regex', [0])[0]) # no interface currently
-    hitsFrom = int(request.form.get('from', [0])[0])
+    needle = request.form.get(fieldname, '')
+    case = int(request.form.get('case', 0))
+    regex = int(request.form.get('regex', 0)) # no interface currently
+    hitsFrom = int(request.form.get('from', 0))
     mtime = None
     msg = ''
     historysearch = 0
 
     # if advanced search is enabled we construct our own search query
     if advancedsearch:
-        and_terms = request.form.get('and_terms', [''])[0].strip()
-        or_terms = request.form.get('or_terms', [''])[0].strip()
-        not_terms = request.form.get('not_terms', [''])[0].strip()
-        #xor_terms = request.form.get('xor_terms', [''])[0].strip()
-        categories = request.form.get('categories', [''])
-        timeframe = request.form.get('time', [''])[0].strip()
-        language = request.form.get('language', [''])
-        mimetype = request.form.get('mimetype', [0])
-        excludeunderlay = request.form.get('excludeunderlay', [0])[0]
-        nosystemitems = request.form.get('nosystemitems', [0])[0]
-        historysearch = request.form.get('historysearch', [0])[0]
+        and_terms = request.form.get('and_terms', '').strip()
+        or_terms = request.form.get('or_terms', '').strip()
+        not_terms = request.form.get('not_terms', '').strip()
+        #xor_terms = request.form.get('xor_terms', '').strip()
+        categories = request.form.getlist('categories') or ['']
+        timeframe = request.form.get('time', '').strip()
+        language = request.form.getlist('language') or ['']
+        mimetype = request.form.getlist('mimetype') or [0]
+        excludeunderlay = request.form.get('excludeunderlay', 0)
+        nosystemitems = request.form.get('nosystemitems', 0)
+        historysearch = request.form.get('historysearch', 0)
 
-        mtime = request.form.get('mtime', [''])[0]
+        mtime = request.form.get('mtime', '')
         if mtime:
             mtime_parsed = None
 
--- a/MoinMoin/action/info.py	Wed Jul 02 18:50:37 2008 +0200
+++ b/MoinMoin/action/info.py	Thu Jul 03 23:36:48 2008 +0200
@@ -205,8 +205,8 @@
         request.write("[%s] " % page.link_to(request, text=text, querystr=querystr, rel='nofollow'))
     request.write(f.paragraph(0))
 
-    show_hitcounts = int(request.form.get('hitcounts', [0])[0]) != 0
-    show_general = int(request.form.get('general', [0])[0]) != 0
+    show_hitcounts = int(request.form.get('hitcounts', 0)) != 0
+    show_general = int(request.form.get('general', 0)) != 0
 
     if show_hitcounts:
         from MoinMoin.stats import hitcounts
--- a/MoinMoin/action/links.py	Wed Jul 02 18:50:37 2008 +0200
+++ b/MoinMoin/action/links.py	Thu Jul 03 23:36:48 2008 +0200
@@ -15,7 +15,7 @@
 
     # get the MIME type
     if 'mimetype' in form:
-        mimetype = form['mimetype'][0]
+        mimetype = form['mimetype']
     else:
         mimetype = "text/html"
 
--- a/MoinMoin/action/login.py	Wed Jul 02 18:50:37 2008 +0200
+++ b/MoinMoin/action/login.py	Thu Jul 03 23:36:48 2008 +0200
@@ -58,7 +58,7 @@
 
         error = None
 
-        islogin = form.get('login', [''])[0]
+        islogin = form.get('login', '')
 
         if islogin: # user pressed login button
             if request._login_multistage:
--- a/MoinMoin/action/newpage.py	Wed Jul 02 18:50:37 2008 +0200
+++ b/MoinMoin/action/newpage.py	Thu Jul 03 23:36:48 2008 +0200
@@ -19,8 +19,8 @@
     def __init__(self, request, referrer):
         self.request = request
         self.referrer = referrer # The page the user came from
-        self.pagename = self.request.form.get('pagename', [None])[0]
-        self.nametemplate = self.request.form.get('nametemplate', ['%s'])[0]
+        self.pagename = self.request.form.get('pagename')
+        self.nametemplate = self.request.form.get('nametemplate', '%s')
         self.nametemplate = self.nametemplate.replace('\x00', '')
 
     def checkAndCombineArguments(self):
@@ -82,11 +82,11 @@
             pagename = self.pagename
             query = {'action': 'edit', 'backto': self.referrer}
 
-            template = self.request.form.get('template', [''])[0]
+            template = self.request.form.get('template', '')
             if template:
                 query['template'] = template
 
-            parent = self.request.form.get('parent', [''])[0]
+            parent = self.request.form.get('parent', '')
             if parent:
                 pagename = "%s/%s" % (parent, pagename)
 
--- a/MoinMoin/action/recoverpass.py	Wed Jul 02 18:50:37 2008 +0200
+++ b/MoinMoin/action/recoverpass.py	Thu Jul 03 23:36:48 2008 +0200
@@ -29,7 +29,7 @@
 Contact the owner of the wiki, who can enable email.""")
 
     try:
-        email = wikiutil.clean_input(form['email'][0].lower())
+        email = wikiutil.clean_input(form['email'].lower())
         if not email:
             # continue if email not given
             raise KeyError
@@ -41,7 +41,7 @@
         pass
 
     try:
-        username = wikiutil.clean_input(form['name'][0])
+        username = wikiutil.clean_input(form['name'])
         if not username:
             # continue if name not given
             raise KeyError
@@ -149,13 +149,13 @@
         page.send_page()
         return
 
-    submitted = form.get('account_sendmail', [''])[0]
-    token = form.get('token', [''])[0]
-    newpass = form.get('password', [''])[0]
-    name = form.get('name', [''])[0]
+    submitted = form.get('account_sendmail', '')
+    token = form.get('token', '')
+    newpass = form.get('password', '')
+    name = form.get('name', '')
 
     if token and name and newpass:
-        newpass2 = form.get('password_repeat', [''])[0]
+        newpass2 = form.get('password_repeat', '')
         msg = _("Passwords don't match!")
         msg_type = 'error'
         if newpass == newpass2:
--- a/MoinMoin/action/refresh.py	Wed Jul 02 18:50:37 2008 +0200
+++ b/MoinMoin/action/refresh.py	Thu Jul 03 23:36:48 2008 +0200
@@ -11,10 +11,10 @@
 def execute(pagename, request):
     """ Handle refresh action """
     # Without arguments, refresh action will refresh the page text_html cache.
-    arena = request.form.get('arena', ['Page.py'])[0]
+    arena = request.form.get('arena', 'Page.py')
     if arena == 'Page.py':
         arena = Page(request, pagename)
-    key = request.form.get('key', ['text_html'])[0]
+    key = request.form.get('key', 'text_html')
 
     # Remove cache entry (if exists), and send the page
     from MoinMoin import caching
--- a/MoinMoin/action/revert.py	Wed Jul 02 18:50:37 2008 +0200
+++ b/MoinMoin/action/revert.py	Thu Jul 03 23:36:48 2008 +0200
@@ -51,7 +51,7 @@
     def do_action(self):
         """ revert pagename """
         form = self.form
-        comment = form.get('comment', [u''])[0]
+        comment = form.get('comment', u'')
         comment = wikiutil.clean_input(comment)
 
         if self.request.method != 'POST':
--- a/MoinMoin/action/rss_rc.py	Wed Jul 02 18:50:37 2008 +0200
+++ b/MoinMoin/action/rss_rc.py	Thu Jul 03 23:36:48 2008 +0200
@@ -33,22 +33,22 @@
     # get params
     items_limit = 100
     try:
-        max_items = int(request.form['items'][0])
+        max_items = int(request.form['items'])
         max_items = min(max_items, items_limit) # not more than `items_limit`
     except (KeyError, ValueError):
         # not more than 15 items in a RSS file by default
         max_items = 15
     try:
-        unique = int(request.form.get('unique', [0])[0])
+        unique = int(request.form.get('unique', 0))
     except ValueError:
         unique = 0
     try:
-        diffs = int(request.form.get('diffs', [0])[0])
+        diffs = int(request.form.get('diffs', 0))
     except ValueError:
         diffs = 0
     ## ddiffs inserted by Ralf Zosel <ralf@zosel.com>, 04.12.2003
     try:
-        ddiffs = int(request.form.get('ddiffs', [0])[0])
+        ddiffs = int(request.form.get('ddiffs', 0))
     except ValueError:
         ddiffs = 0
 
--- a/MoinMoin/action/serveopenid.py	Wed Jul 02 18:50:37 2008 +0200
+++ b/MoinMoin/action/serveopenid.py	Thu Jul 03 23:36:48 2008 +0200
@@ -188,7 +188,7 @@
         server_url = request.getQualifiedURL(
                          request.page.url(request, querystr={'action': 'serveopenid'}))
 
-        yadis_type = form.get('yadis', [None])[0]
+        yadis_type = form.get('yadis')
         if yadis_type == 'ep':
             return self.serveYadisEP(server_url)
         elif yadis_type == 'idp':
@@ -196,7 +196,7 @@
 
         # if the identity is set it must match the server URL
         # sort of arbitrary, but we have to have some restriction
-        identity = form.get('openid.identity', [None])[0]
+        identity = form.get('openid.identity')
         if identity == IDENTIFIER_SELECT:
             identity, server_url = self._make_identity()
             if not identity:
@@ -215,7 +215,7 @@
         openidsrv = server.Server(store, op_endpoint=server_url)
 
         answer = None
-        if form.has_key('dontapprove'):
+        if 'dontapprove' in form:
             answer = self.handle_response(False, username, identity)
             if answer is None:
                 return
@@ -225,8 +225,8 @@
                 return
         else:
             query = {}
-            for key in form.keys():
-                query[key] = form[key][0]
+            for key in form:
+                query[key] = form[key]
             try:
                 openidreq = openidsrv.decodeRequest(query)
             except Exception, e:
@@ -263,7 +263,7 @@
         if session_nonce is not None:
             del self.request.session['openidserver.nonce']
         # use empty string if nothing was sent
-        form_nonce = form.get('nonce', [''])[0]
+        form_nonce = form.get('nonce', '')
         if session_nonce != form_nonce:
             self.request.makeForbidden403()
             self.request.write('invalid nonce')
@@ -282,7 +282,7 @@
             return openidreq.answer(False)
 
 
-        if form.get('remember', ['no'])[0] == 'yes':
+        if form.get('remember', 'no') == 'yes':
             if not hasattr(request.user, 'openid_trusted_roots'):
                 request.user.openid_trusted_roots = []
             request.user.openid_trusted_roots.append(strbase64(openidreq.trust_root))
--- a/MoinMoin/action/sitemap.py	Wed Jul 02 18:50:37 2008 +0200
+++ b/MoinMoin/action/sitemap.py	Thu Jul 03 23:36:48 2008 +0200
@@ -83,7 +83,7 @@
 
     # Get page dict readable by current user
     try:
-        underlay = int(form.get('underlay', [1])[0])
+        underlay = int(form.get('underlay', 1))
     except ValueError:
         underlay = 1
     pages = request.rootpage.getPageDict(include_underlay=underlay)
--- a/MoinMoin/action/titleindex.py	Wed Jul 02 18:50:37 2008 +0200
+++ b/MoinMoin/action/titleindex.py	Thu Jul 03 23:36:48 2008 +0200
@@ -18,7 +18,7 @@
 
     # get the MIME type
     if 'mimetype' in form:
-        mimetype = form['mimetype'][0]
+        mimetype = form['mimetype']
     else:
         mimetype = "text/plain"
     request.mimetype = mimetype
--- a/MoinMoin/action/userprefs.py	Wed Jul 02 18:50:37 2008 +0200
+++ b/MoinMoin/action/userprefs.py	Thu Jul 03 23:36:48 2008 +0200
@@ -16,7 +16,7 @@
     Return error msg_class, msg tuple or None, None.
     """
     _ = request.getText
-    sub = request.form.get('handler', [None])[0]
+    sub = request.form.get('handler')
 
     if sub in request.cfg.userprefs_disabled:
         return None, None
@@ -68,7 +68,7 @@
     else:
         msg_class, msg = None, None
 
-    sub = request.form.get('sub', [''])[0]
+    sub = request.form.get('sub', '')
     cls = None
     if sub and sub not in request.cfg.userprefs_disabled:
         try:
--- a/MoinMoin/action/userprofile.py	Wed Jul 02 18:50:37 2008 +0200
+++ b/MoinMoin/action/userprofile.py	Thu Jul 03 23:36:48 2008 +0200
@@ -17,9 +17,9 @@
     if not request.user.isSuperUser():
         request.theme.add_msg(_("Only superuser is allowed to use this action."), "error")
     else:
-        user_name = form.get('name', [''])[0]
-        key = form.get('key', [''])[0]
-        val = form.get('val', [''])[0]
+        user_name = form.get('name', '')
+        key = form.get('key', '')
+        val = form.get('val', '')
         if key in cfg.user_checkbox_fields:
             val = int(val)
         uid = user.getUserId(request, user_name)