summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2005-11-30 02:36:26 +0000
committerAdrian Holovaty <adrian@holovaty.com>2005-11-30 02:36:26 +0000
commit0ecdad8593356086ccb9365323e0718337bb2b18 (patch)
treed3443060387cf4795ae30d0b4d8f10fc15379f5f
parent804154b9e00e1789cdfed97f3619a146a1da1d5d (diff)
Moved parse_sql import in django.utils.httpwrappers to the top of the module, not inside QueryDict.__init__()
git-svn-id: http://code.djangoproject.com/svn/django/trunk@1503 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/utils/httpwrappers.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/django/utils/httpwrappers.py b/django/utils/httpwrappers.py
index 5906c2ea31..305ef51607 100644
--- a/django/utils/httpwrappers.py
+++ b/django/utils/httpwrappers.py
@@ -3,6 +3,12 @@ from pprint import pformat
from urllib import urlencode
from django.utils.datastructures import MultiValueDict
+try:
+ # 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
+
class HttpRequest(object): # needs to be new-style class because subclasses define "property"s
"A basic HTTP request"
def __init__(self):
@@ -61,10 +67,6 @@ class QueryDict(MultiValueDict):
"""A specialized MultiValueDict that takes a query string when initialized.
This is immutable unless you create a copy of it."""
def __init__(self, query_string):
- try:
- from mod_python.util import parse_qsl
- except ImportError:
- from cgi import parse_qsl
if not query_string:
self.data = {}
self._keys = []