Commits

Mike Orr committed 5832a28

Python 2.6 patch for webhelpers.util by Mike Verdone.

  • Participants
  • Parent commits 532835a

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)
 ------------------

File 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():