Different handling of query params in Py 2.3 and 2.4

guest avatarguest created an issue

I noticed this problem with CherryPy 2.2.1 (as used in TurboGears).

Not sure whether the CherryPy 2.2 branch is still supported and whether this problem still exists in CherryPy 3, but I'll report it anyway.

The query string "?x=&y=" results in x and y becoming empty strings which is ok. However, the (actually illegal) query string "?x&y" is treated differently under Python 2.3 and 2.4/2.5. With Python 2.3, the values x and y are ignored, while with Python 2.4/2.5 they are empty strings. (To increase the confusion, just found an old patch #119 according to which x and y should be set to True in this case.) I think setting x and y to an empty string in this case is the best solution because it allows for nicer URLs for boolean parameters (I would not expect True in this case). Anyway, CherryPy should behave consistently for all Python versions.

Comments (2)

  1. Robert Brewer

    CherryPy 3 doesn't keep_blank_values at all. If someone wants this behavior, they're free to inspect request.query_string themselves, either inside the page handler or in a custom dispatcher.

  2. Log in to comment
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.