0.91-bugfixes: Backport [3820] to 0.91-bugfixes, refs #2745.
git-svn-id: http://code.djangoproject.com/svn/django/branches/0.91-bugfixes@4099 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
2823775114
commit
f931905517
|
@ -55,9 +55,30 @@ class WSGIRequest(httpwrappers.HttpRequest):
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
from pprint import pformat
|
from pprint import pformat
|
||||||
return '<DjangoRequest\nGET:%s,\nPOST:%s,\nCOOKIES:%s,\nMETA:%s>' % \
|
# Since this is called as part of error handling, we need to be very
|
||||||
(pformat(self.GET), pformat(self.POST), pformat(self.COOKIES),
|
# robust against potentially malformed input.
|
||||||
pformat(self.META))
|
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 '<DjangoRequest\npath:%s,\nGET:%s,\nPOST:%s,\nCOOKIES:%s,\nMETA:%s,\nuser:%s>' % \
|
||||||
|
(self.path, get, post, cookies, meta, user)
|
||||||
|
|
||||||
def get_full_path(self):
|
def get_full_path(self):
|
||||||
return '%s%s' % (self.path, self.environ['QUERY_STRING'] and ('?' + self.environ['QUERY_STRING']) or '')
|
return '%s%s' % (self.path, self.environ['QUERY_STRING'] and ('?' + self.environ['QUERY_STRING']) or '')
|
||||||
|
|
Loading…
Reference in New Issue