summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/http/request.py7
-rw-r--r--docs/releases/1.8.txt6
-rw-r--r--tests/requests/tests.py7
3 files changed, 19 insertions, 1 deletions
diff --git a/django/http/request.py b/django/http/request.py
index e5e4c51114..175cdd58b5 100644
--- a/django/http/request.py
+++ b/django/http/request.py
@@ -49,7 +49,12 @@ class HttpRequest(object):
# Any variable assignment made here should also happen in
# `WSGIRequest.__init__()`.
- self.GET, self.POST, self.COOKIES, self.META, self.FILES = {}, {}, {}, {}, {}
+ self.GET = QueryDict(mutable=True)
+ self.POST = QueryDict(mutable=True)
+ self.COOKIES = {}
+ self.META = {}
+ self.FILES = MultiValueDict()
+
self.path = ''
self.path_info = ''
self.method = None
diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt
index 11b051fc70..96bcc55051 100644
--- a/docs/releases/1.8.txt
+++ b/docs/releases/1.8.txt
@@ -220,6 +220,12 @@ Requests and Responses
instantiated with ``QueryDict()`` instead of ``QueryDict(None)`` or
``QueryDict('')``.
+* The ``GET`` and ``POST`` attributes of an :class:`~django.http.HttpRequest`
+ object are now :class:`~django.http.QueryDict`\s rather than dictionaries,
+ and the ``FILES`` attribute is now a ``MultiValueDict``.
+ This brings this class into line with the documentation and with
+ ``WSGIRequest``.
+
Tests
^^^^^
diff --git a/tests/requests/tests.py b/tests/requests/tests.py
index 3f30f75eea..b778fe3718 100644
--- a/tests/requests/tests.py
+++ b/tests/requests/tests.py
@@ -27,6 +27,13 @@ class RequestsTests(SimpleTestCase):
self.assertEqual(list(request.COOKIES.keys()), [])
self.assertEqual(list(request.META.keys()), [])
+ # .GET and .POST should be QueryDicts
+ self.assertEqual(request.GET.urlencode(), '')
+ self.assertEqual(request.POST.urlencode(), '')
+
+ # and FILES should be MultiValueDict
+ self.assertEqual(request.FILES.getlist('foo'), [])
+
def test_httprequest_repr(self):
request = HttpRequest()
request.path = '/somepath/'