Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Consistent imports for parse_qsl function, avoiding the `PendingDepre…

…cationWarning` under Python 2.6 and later

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14297 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 6be00774a4d65fc4d84c297ca6bd36c9c86fbca9 1 parent 40a2a1c
@spookylukey spookylukey authored
Showing with 16 additions and 3 deletions.
  1. +9 −2 django/core/cache/__init__.py
  2. +7 −1 django/http/__init__.py
View
11 django/core/cache/__init__.py
@@ -16,9 +16,16 @@
"""
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:
- 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.core import signals
View
8 django/http/__init__.py
@@ -10,7 +10,13 @@
# The mod_python version is more efficient, so try importing it first.
from mod_python.util import parse_qsl
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.encoding import smart_str, iri_to_uri, force_unicode
Please sign in to comment.
Something went wrong with that request. Please try again.