Small importing change in django.utils.httpwrappers. Refs #736.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1502 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2005-11-30 02:35:06 +00:00
parent 3cb20c45c7
commit 804154b9e0
1 changed files with 5 additions and 5 deletions

View File

@ -1,7 +1,7 @@
from Cookie import SimpleCookie from Cookie import SimpleCookie
from pprint import pformat from pprint import pformat
from urllib import urlencode from urllib import urlencode
from django.utils import datastructures from django.utils.datastructures import MultiValueDict
class HttpRequest(object): # needs to be new-style class because subclasses define "property"s class HttpRequest(object): # needs to be new-style class because subclasses define "property"s
"A basic HTTP request" "A basic HTTP request"
@ -33,8 +33,8 @@ def parse_file_upload(header_dict, post_data):
raw_message = '\r\n'.join(['%s:%s' % pair for pair in header_dict.items()]) raw_message = '\r\n'.join(['%s:%s' % pair for pair in header_dict.items()])
raw_message += '\r\n\r\n' + post_data raw_message += '\r\n\r\n' + post_data
msg = email.message_from_string(raw_message) msg = email.message_from_string(raw_message)
POST = datastructures.MultiValueDict() POST = MultiValueDict()
FILES = datastructures.MultiValueDict() FILES = MultiValueDict()
for submessage in msg.get_payload(): for submessage in msg.get_payload():
if isinstance(submessage, email.Message.Message): if isinstance(submessage, email.Message.Message):
name_dict = parse_header(submessage['Content-Disposition'])[1] name_dict = parse_header(submessage['Content-Disposition'])[1]
@ -57,7 +57,7 @@ def parse_file_upload(header_dict, post_data):
POST.appendlist(name_dict['name'], submessage.get_payload()) POST.appendlist(name_dict['name'], submessage.get_payload())
return POST, FILES return POST, FILES
class QueryDict(datastructures.MultiValueDict): class QueryDict(MultiValueDict):
"""A specialized MultiValueDict that takes a query string when initialized. """A specialized MultiValueDict that takes a query string when initialized.
This is immutable unless you create a copy of it.""" This is immutable unless you create a copy of it."""
def __init__(self, query_string): def __init__(self, query_string):
@ -98,7 +98,7 @@ class QueryDict(datastructures.MultiValueDict):
def copy(self): def copy(self):
"Returns a mutable copy of this object" "Returns a mutable copy of this object"
cp = datastructures.MultiValueDict.copy(self) cp = MultiValueDict.copy(self)
cp._mutable = True cp._mutable = True
return cp return cp