Eric Radman wrote:
One of my applications is failing under wsgikit because it requires
input from both both POST and GET variables in the fields dictionary.

This is the test I'm using:

from wsgikit.webkit.wkservlet import Page

class test(Page):
    def writeBodyParts(self):
        self.writeln("""<p>Request Method: %s""" %  self.request().method())
        self.writeln("""<form method="POST" action="test.py?id=10"> <input
            name='password' /> <input type="submit" /> </form>""")
        self.writeln("""<p>Field variables:</p>""")
        self.writeln("""<pre>""")
        fields = self.request().fields()
        for field in fields:
            self.writeln("%s : %s" % (field, fields[field]))
        self.writeln("""</pre>""")

Under Webware the fields dictionary contains the values from the query
string as well as the POST content. Webware overloads cgi.FieldStorage()
and creates a new class that explicitly parses the query string even if
the HTTP request type was not GET.

I tried to copy this from Webware... or at least I thought I did. I think I couldn't figure out what the FieldStorage subclass was doing, so I ended up deleting it after I put it in.


It's unclear to me how this should be implemented, but I assume it has
to tie into the HTTPRequest._setupFields() function in wkrequest.py

I just checked in a change to that method that should do it, though I haven't tested it. I think the overloaded FieldStorage in WebUtils is unnecessary -- but maybe that's because older cgi.py's didn't have a public parse_qs() function?


I really should have unit tests. The positive part is that it should be really easy to implement tests; creating and executing fake WSGI requests is really easy. I'll try to work on that soon.

--
Ian Bicking  /  [EMAIL PROTECTED]  /  http://blog.ianbicking.org


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
_______________________________________________
Webware-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-devel

Reply via email to