summaryrefslogtreecommitdiff
path: root/tests/regressiontests/requests/tests.py
diff options
context:
space:
mode:
authorGary Wilson Jr <gary.wilson@gmail.com>2008-03-08 03:06:30 +0000
committerGary Wilson Jr <gary.wilson@gmail.com>2008-03-08 03:06:30 +0000
commitd73c70d1ed34b53c21909f9d772a12bf85504601 (patch)
tree59295e2a4df2637ac2c6874cde988766cdade132 /tests/regressiontests/requests/tests.py
parent1e2852a15dd120ff542a4805d8dceed82fb56ba7 (diff)
Fixed #5595 -- Made `ModPythonRequest.__repr__` return a string instead of a unicode object. Fixes the printout of the request object in those server error e-mails I never get :)
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7200 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/requests/tests.py')
-rw-r--r--tests/regressiontests/requests/tests.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/regressiontests/requests/tests.py b/tests/regressiontests/requests/tests.py
new file mode 100644
index 0000000000..890dc33c59
--- /dev/null
+++ b/tests/regressiontests/requests/tests.py
@@ -0,0 +1,34 @@
+"""
+>>> from django.http import HttpRequest
+>>> print repr(HttpRequest())
+<HttpRequest
+GET:{},
+POST:{},
+COOKIES:{},
+META:{}>
+
+>>> from django.core.handlers.wsgi import WSGIRequest
+>>> print repr(WSGIRequest({'PATH_INFO': 'bogus', 'REQUEST_METHOD': 'bogus'}))
+<WSGIRequest
+GET:<QueryDict: {}>,
+POST:<QueryDict: {}>,
+COOKIES:{},
+META:{'REQUEST_METHOD': 'bogus', 'PATH_INFO': 'bogus'}>
+
+>>> from django.core.handlers.modpython import ModPythonRequest
+>>> class FakeModPythonRequest(ModPythonRequest):
+... def __init__(self, *args, **kwargs):
+... super(FakeModPythonRequest, self).__init__(*args, **kwargs)
+... self._get = self._post = self._meta = self._cookies = {}
+>>> class Dummy: pass
+...
+>>> req = Dummy()
+>>> req.uri = 'bogus'
+>>> print repr(FakeModPythonRequest(req))
+<ModPythonRequest
+path:bogus,
+GET:{},
+POST:{},
+COOKIES:{},
+META:{}>
+"""