Merge pull request #909 from VKen/master

updated deprecated cgi.parse_qsl to use six's parse_qsl
This commit is contained in:
Mikhail Korobov 2014-10-03 16:30:39 +06:00
commit 14957ed71e
1 changed files with 3 additions and 3 deletions

View File

@ -6,9 +6,9 @@ Some of the functions that used to be imported from this module have been moved
to the w3lib.url module. Always import those from there instead.
"""
import posixpath
from six.moves.urllib.parse import ParseResult, urlunparse, urldefrag, urlparse
from six.moves.urllib.parse import (ParseResult, urlunparse, urldefrag,
urlparse, parse_qsl)
import urllib
import cgi
# scrapy.utils.url was moved to w3lib.url and import * ensures this move doesn't break old code
from w3lib.url import *
@ -54,7 +54,7 @@ def canonicalize_url(url, keep_blank_values=True, keep_fragments=False,
"""
scheme, netloc, path, params, query, fragment = parse_url(url)
keyvals = cgi.parse_qsl(query, keep_blank_values)
keyvals = parse_qsl(query, keep_blank_values)
keyvals.sort()
query = urllib.urlencode(keyvals)
path = safe_url_string(_unquotepath(path)) or '/'