Mike Orr avatar Mike Orr committed 5832a28

Python 2.6 patch for webhelpers.util by Mike Verdone.

Comments (0)

Files changed (2)

 
 tip (development version)
 -------------------------
+* Delete ``webhelpers.string24``.  WebHelpers no longer supports Python 2.3.
+
 * webhelpers.html.grid_demo:
 
   - Demonstrates ``webhelpers.html.grid``. Run as 
 
   - Bugfixes.
 
-* webhelpers.string24:
+* webhelpers.util:
 
-  - Delete module. WebHelpers no longer supports Python 2.3.
+  - Bugfix: ``parse_qs`` moved from ``cgi`` to ``urlparse`` in Python 2.6.
+    Patch by Mike Verdone.
 
 1.0b3 (2009-12-29)
 ------------------

webhelpers/util.py

 from UserDict import DictMixin
 from xml.sax.saxutils import XMLGenerator
 
+try:
+    from urlparse import parse_qs
+except ImportError:   # Python < 2.6
+    from cgi import parse_qs
+
+
 def update_params(url, **params):
     """Update query parameters in a URL.
 
     url, fragment = urlparse.urldefrag(url)
     if "?" in url:
         url, qs = url.split("?", 1)
-        query = urlparse.parse_qs(qs)
+        query = parse_qs(qs)
     else:
         query = {}
     for key, value in params.iteritems():
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.