From 2823775114d4e27262e2b1e33e91a994b25a1402 Mon Sep 17 00:00:00 2001 From: James Bennett Date: Fri, 24 Nov 2006 18:24:34 +0000 Subject: [PATCH] 0.91-bugfixes: Backport [3820] to 0.91-bugfixes, refs #2745. git-svn-id: http://code.djangoproject.com/svn/django/branches/0.91-bugfixes@4098 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/core/handlers/modpython.py | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/django/core/handlers/modpython.py b/django/core/handlers/modpython.py index cb65170c1a..34c21c52df 100644 --- a/django/core/handlers/modpython.py +++ b/django/core/handlers/modpython.py @@ -13,9 +13,30 @@ class ModPythonRequest(httpwrappers.HttpRequest): self.path = req.uri def __repr__(self): + # Since this is called as part of error handling, we need to be very + # robust against potentially malformed input. + try: + get = pformat(self.GET) + except: + get = '' + try: + post = pformat(self.POST) + except: + post = '' + try: + cookies = pformat(self.COOKIES) + except: + cookies = '' + try: + meta = pformat(self.META) + except: + meta = '' + try: + user = self.user + except: + user = '' return '' % \ - (self.path, pformat(self.GET), pformat(self.POST), pformat(self.COOKIES), - pformat(self.META), pformat(self.user)) + (self.path, get, post, cookies, meta, user) def get_full_path(self): return '%s%s' % (self.path, self._req.args and ('?' + self._req.args) or '')