From 0ecdad8593356086ccb9365323e0718337bb2b18 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Wed, 30 Nov 2005 02:36:26 +0000 Subject: [PATCH] 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 --- django/utils/httpwrappers.py | 10 ++++++---- 1 file 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 = []