[Moin-user] patch to fix mixed GET/POST vars

Matthew Nuzum newz at bearfruit.org
Tue Sep 26 17:43:24 EDT 2006


Thomas Waldmann helped me find the problem with my action not being
recognized when a form was submitted via post. He indicated that 1.5.x
ignored GET in the presense of POST and that it was fixed in 1.6.

Here is a patch that allows this to work in 1.5 as well (I don't do
patches too often, so let me know if you need this in an alternate
format).

Also, I've noticed that my editor complains and won't save files
because there is an invalid iso-8859-1 char in the file. The files all
seem to have:
# -*- coding: iso-8859-1 -*-

However, some files also have:
@copyright: 2001-2003 by Jorgen Hermann <jh at web.de>
(where the o in Jorgen is a non iso-8859-1 char). Interestingly,
though I changed the char in my local copy of the file, it didn't show
up in the diff.

diff -u request.py.orig request.py
--- request.py.orig     2006-09-26 16:32:30.000000000 -0500
+++ request.py  2006-09-26 16:35:07.000000000 -0500
@@ -898,10 +898,13 @@

         TODO: The form argument should be removed in 1.5.
         """
-        if form is not None or self.request_method == 'POST':
-            return self._setup_args_from_cgi_form(form)
         args = cgi.parse_qs(self.query_string, keep_blank_values=1)
-        return self.decodeArgs(args)
+        args = self.decodeArgs(args)
+        # if we have form data (in a POST), those override the stuff
we already have:
+        if self.request_method == 'POST':
+            postargs = self._setup_args_from_cgi_form()
+            args.update(postargs)
+        return args

     def _setup_args_from_cgi_form(self, form=None):
         """ Return args dict from a FieldStorage


-- 
Matthew Nuzum
www.bearfruit.org
newz2000 on freenode




More information about the Moin-user mailing list