Hello list,

I got myselft to start writing test code for my turbogear-1.x project
with twill. So, I use wsgi_intercept.add_wsgi_intercept() in my
testcase. It worked well except for the query_string value.

In make_environ function in the file wsgi_intercept.py, query_string
is decoded and stored as environ, but in my opinion, it shouldn't be
decoded in this stage. Actually, decoding the query_string in this
stage breaks encoded plus value (%2B)  in the query string of the URL
because my app will decode this value once again, and treat it as just
a space.

In short, query string is decoded twice like following
%2B -> + -> SPACE

Please look into the attached file. This change doesn't break the
twill's unittest at all.

Regards,

-- Takashi
diff -uNr -x '*.pyc' twill-latest.org/twill/wsgi_intercept.py twill-latest/twill/wsgi_intercept.py
--- twill-latest.org/twill/wsgi_intercept.py	2008-04-15 17:05:33.000000000 +0900
+++ twill-latest/twill/wsgi_intercept.py	2008-04-16 09:08:03.000000000 +0900
@@ -121,7 +121,7 @@
     path_info = urllib.unquote_plus(url[0])
     query_string = ""
     if len(url) == 2:
-        query_string = urllib.unquote_plus(url[1])
+        query_string = url[1]
 
     if debuglevel:
         print "method: %s; script_name: %s; path_info: %s; query_string: %s" % (method, script_name, path_info, query_string)
_______________________________________________
twill mailing list
[email protected]
http://lists.idyll.org/listinfo/twill

Reply via email to