Commits

Anonymous committed cd137e4

[svn] o fixing current_page incompatibilitly with python 2.3
Resolves: #41
o documenting parse_querystring

  • Participants
  • Parent commits 050dbd6

Comments (0)

Files changed (1)

webhelpers/rails/urls.py

     link_to_unless(not condition, name, url, **html_options)
 
 def parse_querystring(environ):
+    """
+    Parses a query string into a list like ``[(name, value)]``.
+
+    You can pass the result to ``dict()``, but be aware that keys that appear multiple
+    times will be lost (only the last value will be preserved).
+
+    This function is cut and pasted from paste.request.parse_querystring (minus its
+    caching piece) to avoid requiring paste as a dependency.
+    """
     source = environ.get('QUERY_STRING', '')
     parsed = cgi.parse_qsl(source, keep_blank_values=True,
                            strict_parsing=False)
     curopts = config.mapper_dict.copy()
     if environ.get('REQUEST_METHOD', 'GET') == 'GET':
         if environ.has_key('QUERY_STRING'):
-            curopts.update(parse_querystring(environ))
+            curopts.update(dict(parse_querystring(environ)))
     currl = url_for(**curopts)
     if callable(url):
         return url() == currl