Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
  • Loading branch information...
commit 2823775114d4e27262e2b1e33e91a994b25a1402 1 parent 1fcef7a
James Bennett authored November 24, 2006

Showing 1 changed file with 23 additions and 2 deletions. Show diff stats Hide diff stats

  1. 25  django/core/handlers/modpython.py
25  django/core/handlers/modpython.py
@@ -13,9 +13,30 @@ def __init__(self, req):
13 13
         self.path = req.uri
14 14
 
15 15
     def __repr__(self):
  16
+        # Since this is called as part of error handling, we need to be very
  17
+        # robust against potentially malformed input.
  18
+        try:
  19
+            get = pformat(self.GET)
  20
+        except:
  21
+            get = '<could not parse>'
  22
+        try:
  23
+            post = pformat(self.POST)
  24
+        except:
  25
+            post = '<could not parse>'
  26
+        try:
  27
+            cookies = pformat(self.COOKIES)
  28
+        except:
  29
+            cookies = '<could not parse>'
  30
+        try:
  31
+            meta = pformat(self.META)
  32
+        except:
  33
+            meta = '<could not parse>'
  34
+        try:
  35
+            user = self.user
  36
+        except:
  37
+            user = '<could not parse>'
16 38
         return '<ModPythonRequest\npath:%s,\nGET:%s,\nPOST:%s,\nCOOKIES:%s,\nMETA:%s,\nuser:%s>' % \
17  
-            (self.path, pformat(self.GET), pformat(self.POST), pformat(self.COOKIES),
18  
-            pformat(self.META), pformat(self.user))
  39
+               (self.path, get, post, cookies, meta, user)
19 40
 
20 41
     def get_full_path(self):
21 42
         return '%s%s' % (self.path, self._req.args and ('?' + self._req.args) or '')

0 notes on commit 2823775

Please sign in to comment.
Something went wrong with that request. Please try again.