Modified canonicalize_url to make it always work with regular strings

--HG--
extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%40433
This commit is contained in:
elpolilla 2008-11-26 16:18:19 +00:00
parent 8eab5802cd
commit 0958eecfca
1 changed files with 1 additions and 0 deletions

View File

@ -138,6 +138,7 @@ def canonicalize_url(url, keep_blank_values=False, keep_fragments=False):
For examples see the tests in scrapy.tests.test_utils_url
"""
url = str(url) # URLs *must* be a string; otherwise urllib may fail.
parts = list(urlparse.urlparse(url))
keyvals = cgi.parse_qsl(parts[4], keep_blank_values)
keyvals.sort()