changeset 4237:162002d5b148

Replaced some references to request.form with MultiDict-compatible semantics
author Florian Krupicka <florian.krupicka@googlemail.com>
date Sun, 20 Jul 2008 18:49:20 +0200
parents 97bffc03c15f
children f36c84edb3fd
files MoinMoin/Page.py MoinMoin/PageEditor.py MoinMoin/PageGraphicalEditor.py MoinMoin/action/DeletePage.py MoinMoin/auth/openidrp.py MoinMoin/macro/FullSearch.py MoinMoin/macro/MonthCalendar.py MoinMoin/macro/TeudView.py MoinMoin/stats/hitcounts.py MoinMoin/userprefs/oid.py MoinMoin/userprefs/suid.py MoinMoin/util/web.py MoinMoin/widget/browser.py
diffstat 13 files changed, 31 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/Page.py	Sun Jul 20 18:32:36 2008 +0200
+++ b/MoinMoin/Page.py	Sun Jul 20 18:49:20 2008 +0200
@@ -1114,7 +1114,7 @@
                 # This redirect message is very annoying.
                 # Less annoying now without the warning sign.
                 if 'redirect' in request.form:
-                    redir = request.form['redirect'][0]
+                    redir = request.form['redirect']
                     request.theme.add_msg('<strong>%s</strong><br>' % (
                         _('Redirected from page "%(page)s"') % {'page':
                             wikiutil.link_tag(request, wikiutil.quoteWikinameURL(redir) + "?action=show", self.formatter.text(redir))}), "info")
--- a/MoinMoin/PageEditor.py	Sun Jul 20 18:32:36 2008 +0200
+++ b/MoinMoin/PageEditor.py	Sun Jul 20 18:49:20 2008 +0200
@@ -200,7 +200,7 @@
         # check if we want to load a draft
         use_draft = None
         if 'button_load_draft' in form:
-            wanted_draft_timestamp = int(form.get('draft_ts', ['0'])[0])
+            wanted_draft_timestamp = int(form.get('draft_ts', '0'))
             if wanted_draft_timestamp:
                 draft = self._load_draft()
                 if draft is not None:
@@ -212,7 +212,7 @@
         if use_draft is not None:
             title = _('Draft of "%(pagename)s"')
             # Propagate original revision
-            rev = int(form['draft_rev'][0])
+            rev = int(form['draft_rev'])
             self.set_raw_body(use_draft, modified=1)
             preview = use_draft
         elif preview is None:
@@ -232,7 +232,7 @@
 
         # get request parameters
         try:
-            text_rows = int(form['rows'][0])
+            text_rows = int(form['rows'])
         except StandardError:
             text_rows = self.cfg.edit_rows
             if request.user.valid:
@@ -276,7 +276,7 @@
             raw_body = self.get_raw_body()
         elif 'template' in form:
             # If the page does not exist, we try to get the content from the template parameter.
-            template_page = wikiutil.unquoteWikiname(form['template'][0])
+            template_page = wikiutil.unquoteWikiname(form['template'])
             if request.user.may.read(template_page):
                 raw_body = Page(request, template_page).get_raw_body()
                 if raw_body:
@@ -348,7 +348,7 @@
         request.write('<input type="hidden" name="ticket" value="%s">' % wikiutil.createTicket(request))
 
         # Save backto in a hidden input
-        backto = form.get('backto', [None])[0]
+        backto = form.get('backto')
         if backto:
             request.write(unicode(html.INPUT(type="hidden", name="backto", value=backto)))
 
@@ -407,7 +407,7 @@
     document.write('<label for="chktrivialtop">%(label)s</label>');
     //-->
 </script> ''' % {
-                'checked': ('', 'checked')[form.get('trivial', ['0'])[0] == '1'],
+                'checked': ('', 'checked')[form.get('trivial', '0') == '1'],
                 'label': _("Trivial change"),
             })
 
@@ -457,7 +457,7 @@
 <label for="chktrivial">%(label)s</label>
 
 ''' % {
-                'checked': ('', 'checked')[form.get('trivial', ['0'])[0] == '1'],
+                'checked': ('', 'checked')[form.get('trivial', '0') == '1'],
                 'label': _("Trivial change"),
                 })
 
@@ -466,7 +466,7 @@
 <input type="checkbox" name="rstrip" id="chkrstrip" value="1" %(checked)s>
 <label for="chkrstrip">%(label)s</label>
 ''' % {
-            'checked': ('', 'checked')[form.get('rstrip', ['0'])[0] == '1'],
+            'checked': ('', 'checked')[form.get('rstrip', '0') == '1'],
             'label': _('Remove trailing whitespace from each line')
             })
         request.write("</p>")
@@ -511,7 +511,7 @@
         self._save_draft(newtext, rev) # shall we really save a draft on CANCEL?
         self.lock.release()
 
-        backto = request.form.get('backto', [None])[0]
+        backto = request.form.get('backto')
         if backto:
             pg = Page(request, backto)
             request.http_redirect(pg.url(request, relative=False))
@@ -669,7 +669,7 @@
 
             # Remove cache entry (if exists)
             pg = Page(self.request, self.page_name)
-            key = self.request.form.get('key', ['text_html'])[0]
+            key = self.request.form.get('key', 'text_html')
             caching.CacheEntry(self.request, pg, key, scope='item').remove()
             caching.CacheEntry(self.request, pg, "pagelinks", scope='item').remove()
 
--- a/MoinMoin/PageGraphicalEditor.py	Sun Jul 20 18:32:36 2008 +0200
+++ b/MoinMoin/PageGraphicalEditor.py	Sun Jul 20 18:49:20 2008 +0200
@@ -89,7 +89,7 @@
         # check if we want to load a draft
         use_draft = None
         if 'button_load_draft' in form:
-            wanted_draft_timestamp = int(form.get('draft_ts', ['0'])[0])
+            wanted_draft_timestamp = int(form.get('draft_ts', '0'))
             if wanted_draft_timestamp:
                 draft = self._load_draft()
                 if draft is not None:
@@ -101,7 +101,7 @@
         if use_draft is not None:
             title = _('Draft of "%(pagename)s"')
             # Propagate original revision
-            rev = int(form['draft_rev'][0])
+            rev = int(form['draft_rev'])
             self.set_raw_body(use_draft, modified=1)
             preview = use_draft
         elif preview is None:
@@ -121,7 +121,7 @@
 
         # get request parameters
         try:
-            text_rows = int(form['rows'][0])
+            text_rows = int(form['rows'])
         except StandardError:
             text_rows = self.cfg.edit_rows
             if request.user.valid:
@@ -167,7 +167,7 @@
             raw_body = self.get_raw_body()
         elif 'template' in form:
             # If the page does not exist, we try to get the content from the template parameter.
-            template_page = wikiutil.unquoteWikiname(form['template'][0])
+            template_page = wikiutil.unquoteWikiname(form['template'])
             if request.user.may.read(template_page):
                 raw_body = Page(request, template_page).get_raw_body()
                 if raw_body:
@@ -243,7 +243,7 @@
         request.write('<input type="hidden" name="ticket" value="%s">' % wikiutil.createTicket(request))
 
         # Save backto in a hidden input
-        backto = form.get('backto', [None])[0]
+        backto = form.get('backto')
         if backto:
             request.write(unicode(html.INPUT(type="hidden", name="backto", value=backto)))
 
@@ -294,7 +294,7 @@
 <input type="checkbox" name="trivial" id="chktrivialtop" value="1" %(checked)s onclick="toggle_trivial(this)">
 <label for="chktrivialtop">%(label)s</label>
 ''' % {
-          'checked': ('', 'checked')[form.get('trivial', ['0'])[0] == '1'],
+          'checked': ('', 'checked')[form.get('trivial', '0') == '1'],
           'label': _("Trivial change"),
        })
 
@@ -373,7 +373,7 @@
 &nbsp;
 <input type="checkbox" name="trivial" id="chktrivial" value="1" %(checked)s onclick="toggle_trivial(this)">
 <label for="chktrivial">%(label)s</label> ''' % {
-                'checked': ('', 'checked')[form.get('trivial', ['0'])[0] == '1'],
+                'checked': ('', 'checked')[form.get('trivial', '0') == '1'],
                 'label': _("Trivial change"),
                 })
 
@@ -382,7 +382,7 @@
 <input type="checkbox" name="rstrip" id="chkrstrip" value="1" %(checked)s>
 <label for="chkrstrip">%(label)s</label>
 </p> ''' % {
-            'checked': ('', 'checked')[form.get('rstrip', ['0'])[0] == '1'],
+            'checked': ('', 'checked')[form.get('rstrip', '0') == '1'],
             'label': _('Remove trailing whitespace from each line')
             })
 
--- a/MoinMoin/action/DeletePage.py	Sun Jul 20 18:32:36 2008 +0200
+++ b/MoinMoin/action/DeletePage.py	Sun Jul 20 18:49:20 2008 +0200
@@ -54,7 +54,7 @@
 
         delete_subpages = 0
         try:
-            delete_subpages = int(form['delete_subpages'][0])
+            delete_subpages = int(form['delete_subpages'])
         except:
             pass
 
--- a/MoinMoin/auth/openidrp.py	Sun Jul 20 18:32:36 2008 +0200
+++ b/MoinMoin/auth/openidrp.py	Sun Jul 20 18:49:20 2008 +0200
@@ -134,7 +134,7 @@
                                         MoinOpenIDStore(request))
         query = {}
         for key in request.form:
-            query[key] = request.form[key][0]
+            query[key] = request.form[key]
         current_url = get_multistage_continuation_url(request, self.name,
                                                       {'oidstage': '1'})
         info = oidconsumer.complete(query, current_url)
--- a/MoinMoin/macro/FullSearch.py	Sun Jul 20 18:32:36 2008 +0200
+++ b/MoinMoin/macro/FullSearch.py	Sun Jul 20 18:49:20 2008 +0200
@@ -43,7 +43,7 @@
     """
     _ = macro._
     if 'value' in macro.form:
-        default = wikiutil.escape(macro.form["value"][0], quote=1)
+        default = wikiutil.escape(macro.form["value"], quote=1)
     else:
         default = ''
 
--- a/MoinMoin/macro/MonthCalendar.py	Sun Jul 20 18:32:36 2008 +0200
+++ b/MoinMoin/macro/MonthCalendar.py	Sun Jul 20 18:49:20 2008 +0200
@@ -217,7 +217,7 @@
     # does the url have calendar params (= somebody has clicked on prev/next links in calendar) ?
     if 'calparms' in macro.form:
         has_calparms = 1 # yes!
-        text2 = macro.form['calparms'][0]
+        text2 = macro.form['calparms']
         try:
             cparmpagename, cparmyear, cparmmonth, cparmoffset, cparmoffset2, cparmheight6, cparmanniversary, cparmtemplate = \
                 parseargs(request, text2, thispage, currentyear, currentmonth, 0, 0, False, False, u'')
--- a/MoinMoin/macro/TeudView.py	Sun Jul 20 18:32:36 2008 +0200
+++ b/MoinMoin/macro/TeudView.py	Sun Jul 20 18:49:20 2008 +0200
@@ -34,7 +34,7 @@
     pagename = macro.formatter.page.page_name
 
     if 'module' in macro.form:
-        modname = macro.form["module"][0]
+        modname = macro.form["module"]
         try:
             obj = pydoc.locate(modname)
         except pydoc.ErrorDuringImport, value:
--- a/MoinMoin/stats/hitcounts.py	Sun Jul 20 18:32:36 2008 +0200
+++ b/MoinMoin/stats/hitcounts.py	Sun Jul 20 18:49:20 2008 +0200
@@ -151,7 +151,7 @@
         filterpage = wikiutil.decodeUserInput(params)
 
     if request and request.form and 'page' in request.form:
-        filterpage = request.form['page'][0]
+        filterpage = request.form['page']
 
     days, views, edits = get_data(pagename, request, filterpage)
 
@@ -201,7 +201,7 @@
     # check params
     filterpage = None
     if request and request.form and 'page' in request.form:
-        filterpage = request.form['page'][0]
+        filterpage = request.form['page']
 
     days, views, edits = get_data(pagename, request, filterpage)
 
--- a/MoinMoin/userprefs/oid.py	Sun Jul 20 18:32:36 2008 +0200
+++ b/MoinMoin/userprefs/oid.py	Sun Jul 20 18:49:20 2008 +0200
@@ -100,7 +100,7 @@
                                         MoinOpenIDStore(request))
         query = {}
         for key in request.form:
-            query[key] = request.form[key][0]
+            query[key] = request.form[key]
         qstr = wikiutil.makeQueryString({'action': 'userprefs',
                                          'handler': 'oid',
                                          'oid.return': '1'})
--- a/MoinMoin/userprefs/suid.py	Sun Jul 20 18:32:36 2008 +0200
+++ b/MoinMoin/userprefs/suid.py	Sun Jul 20 18:49:20 2008 +0200
@@ -38,7 +38,7 @@
         if 'cancel' in form:
             return
 
-        if (wikiutil.checkTicket(self.request, self.request.form['ticket'][0])
+        if (wikiutil.checkTicket(self.request, self.request.form['ticket'])
             and self.request.method == 'POST'):
             uid = form.get('selected_user', [''])[0]
             if not uid:
--- a/MoinMoin/util/web.py	Sun Jul 20 18:32:36 2008 +0200
+++ b/MoinMoin/util/web.py	Sun Jul 20 18:49:20 2008 +0200
@@ -14,7 +14,7 @@
         is missing).
     """
     try:
-        result = int(request.form[fieldname][0])
+        result = int(request.form[fieldname])
     except (KeyError, ValueError):
         return default
     else:
--- a/MoinMoin/widget/browser.py	Sun Jul 20 18:32:36 2008 +0200
+++ b/MoinMoin/widget/browser.py	Sun Jul 20 18:49:20 2008 +0200
@@ -74,7 +74,7 @@
         value = None
         name = '%sfilter%d' % (self.data_id, idx)
         if name in self.request.form:
-            value = self.request.form[name][0]
+            value = self.request.form[name]
         while row:
             option = row[idx]
             if isinstance(option, tuple):
@@ -143,7 +143,7 @@
                 for idx in range(len(row)):
                     name = '%sfilter%d' % (self.data_id, idx)
                     if name in self.request.form:
-                        filters[idx] = self.request.form[name][0]
+                        filters[idx] = self.request.form[name]
                         if filters[idx] == self._all:
                             filters[idx] = None