Skip to content

Commit

Permalink
0.91-bugfixes: Backport [3820] to 0.91-bugfixes, refs #2745.
Browse files Browse the repository at this point in the history
git-svn-id: http://code.djangoproject.com/svn/django/branches/0.91-bugfixes@4098 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
ubernostrum committed Nov 24, 2006
1 parent 1fcef7a commit 2823775
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions django/core/handlers/modpython.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -13,9 +13,30 @@ def __init__(self, req):
self.path = req.uri self.path = req.uri


def __repr__(self): 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 = '<could not parse>'
try:
post = pformat(self.POST)
except:
post = '<could not parse>'
try:
cookies = pformat(self.COOKIES)
except:
cookies = '<could not parse>'
try:
meta = pformat(self.META)
except:
meta = '<could not parse>'
try:
user = self.user
except:
user = '<could not parse>'
return '<ModPythonRequest\npath:%s,\nGET:%s,\nPOST:%s,\nCOOKIES:%s,\nMETA:%s,\nuser:%s>' % \ return '<ModPythonRequest\npath:%s,\nGET:%s,\nPOST:%s,\nCOOKIES:%s,\nMETA:%s,\nuser:%s>' % \
(self.path, pformat(self.GET), pformat(self.POST), pformat(self.COOKIES), (self.path, get, post, cookies, meta, user)
pformat(self.META), pformat(self.user))


def get_full_path(self): def get_full_path(self):
return '%s%s' % (self.path, self._req.args and ('?' + self._req.args) or '') return '%s%s' % (self.path, self._req.args and ('?' + self._req.args) or '')
Expand Down

0 comments on commit 2823775

Please sign in to comment.