Consistent imports for parse_qsl function, avoiding the `PendingDeprecationWarning` under Python 2.6 and later
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14297 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
40a2a1c59d
commit
6be00774a4
|
@ -16,9 +16,16 @@ See docs/cache.txt for information on the public API.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from urlparse import parse_qsl
|
# The mod_python version is more efficient, so try importing it first.
|
||||||
|
from mod_python.util import parse_qsl
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from cgi import parse_qsl
|
try:
|
||||||
|
# Python 2.6 and greater
|
||||||
|
from urlparse import parse_qsl
|
||||||
|
except ImportError:
|
||||||
|
# Python 2.5, 2.4. Works on Python 2.6 but raises
|
||||||
|
# PendingDeprecationWarning
|
||||||
|
from cgi import parse_qsl
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core import signals
|
from django.core import signals
|
||||||
|
|
|
@ -10,7 +10,13 @@ try:
|
||||||
# The mod_python version is more efficient, so try importing it first.
|
# The mod_python version is more efficient, so try importing it first.
|
||||||
from mod_python.util import parse_qsl
|
from mod_python.util import parse_qsl
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from cgi import parse_qsl
|
try:
|
||||||
|
# Python 2.6 and greater
|
||||||
|
from urlparse import parse_qsl
|
||||||
|
except ImportError:
|
||||||
|
# Python 2.5, 2.4. Works on Python 2.6 but raises
|
||||||
|
# PendingDeprecationWarning
|
||||||
|
from cgi import parse_qsl
|
||||||
|
|
||||||
from django.utils.datastructures import MultiValueDict, ImmutableList
|
from django.utils.datastructures import MultiValueDict, ImmutableList
|
||||||
from django.utils.encoding import smart_str, iri_to_uri, force_unicode
|
from django.utils.encoding import smart_str, iri_to_uri, force_unicode
|
||||||
|
|
Loading…
Reference in New Issue