Anonymous avatar Anonymous committed cd137e4

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

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