changeset 4426:8982d8226218

pre-1.9: request.form has qs args and post data, 1.9: .form only post data, .args only qs args, .values both
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 18 Nov 2008 21:28:49 +0100
parents 5ad5753ae311
children 06f33d1ce4cb
files MoinMoin/action/AttachFile.py MoinMoin/action/chart.py MoinMoin/action/fckdialog.py MoinMoin/auth/openidrp.py MoinMoin/stats/hitcounts.py
diffstat 5 files changed, 16 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/AttachFile.py	Sun Nov 16 22:20:21 2008 +0100
+++ b/MoinMoin/action/AttachFile.py	Tue Nov 18 21:28:49 2008 +0100
@@ -394,14 +394,14 @@
 
     now = time.time()
     pubpath = request.cfg.url_prefix_static + "/applets/TWikiDrawPlugin"
-    basename = request.form['drawing']
+    basename = request.values['drawing']
     drawpath = getAttachUrl(pagename, basename + '.draw', request, escaped=1)
     pngpath = getAttachUrl(pagename, basename + '.png', request, escaped=1)
     pagelink = request.href(pagename, action=action_name, ts=now)
     helplink = Page(request, "HelpOnActions/AttachFile").url(request)
     savelink = request.href(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']+'.draw'}
+                                           # request, {'savename': request.values['drawing']+'.draw'}
     #savelink = '/cgi-bin/dumpform.bat'
 
     timestamp = '&amp;ts=%s' % now
@@ -480,7 +480,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'):
+    if writeable and request.values.get('drawing'):
         send_hotdraw(pagename, request)
 
 
--- a/MoinMoin/action/chart.py	Sun Nov 16 22:20:21 2008 +0100
+++ b/MoinMoin/action/chart.py	Tue Nov 18 21:28:49 2008 +0100
@@ -19,7 +19,7 @@
         request.theme.add_msg(_("Charts are not available!"), "error")
         return request.page.send_page()
 
-    chart_type = request.form.get('type', '').strip()
+    chart_type = request.values.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/fckdialog.py	Sun Nov 16 22:20:21 2008 +0100
+++ b/MoinMoin/action/fckdialog.py	Tue Nov 18 21:28:49 2008 +0100
@@ -163,7 +163,7 @@
 
 def page_list(request):
     from MoinMoin import search
-    name = request.form.get("pagename", "")
+    name = request.values.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", "")
+    name = request.values.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", "")
+    name = request.values.get("pagename", "")
     if name:
         from MoinMoin import search
         # XXX error handling!
@@ -519,7 +519,7 @@
 #############################################################################
 
 def execute(pagename, request):
-    dialog = request.form.get("dialog", [""])[0]
+    dialog = request.values.get("dialog", "")
 
     if dialog == "macro":
         macro_dialog(request)
--- a/MoinMoin/auth/openidrp.py	Sun Nov 16 22:20:21 2008 +0100
+++ b/MoinMoin/auth/openidrp.py	Tue Nov 18 21:28:49 2008 +0100
@@ -173,7 +173,7 @@
             return CancelLogin(None)
 
         _ = request.getText
-        newname = request.form.get('username', [''])[0]
+        newname = request.form.get('username', '')
         if not newname:
             return MultistageFormLogin(self._get_account_name)
         if not user.isValidName(request, newname):
@@ -198,8 +198,8 @@
             return CancelLogin()
 
         _ = request.getText
-        username = request.form.get('username', [''])[0]
-        password = request.form.get('password', [''])[0]
+        username = request.form.get('username', '')
+        password = request.form.get('password', '')
         if not password:
             return self._handle_name_continuation(request)
         u = user.User(request, name=username, password=password,
@@ -214,7 +214,7 @@
             return MultistageFormLogin(assoc)
 
     def _handle_continuation(self, request):
-        oidstage = request.form.get('oidstage', [0])[0]
+        oidstage = request.form.get('oidstage', '0')
         if oidstage == '1':
             return self._handle_verify_continuation(request)
         elif oidstage == '2':
--- a/MoinMoin/stats/hitcounts.py	Sun Nov 16 22:20:21 2008 +0100
+++ b/MoinMoin/stats/hitcounts.py	Tue Nov 18 21:28:49 2008 +0100
@@ -150,8 +150,8 @@
         params = wikiutil.url_unquote(params, want_unicode=False)
         filterpage = wikiutil.decodeUserInput(params)
 
-    if request and request.form and 'page' in request.form:
-        filterpage = request.form['page']
+    if request and request.values and 'page' in request.values:
+        filterpage = request.values['page']
 
     days, views, edits = get_data(pagename, request, filterpage)
 
@@ -200,8 +200,8 @@
 
     # check params
     filterpage = None
-    if request and request.form and 'page' in request.form:
-        filterpage = request.form['page']
+    if request and request.values and 'page' in request.values:
+        filterpage = request.values['page']
 
     days, views, edits = get_data(pagename, request, filterpage)