diff options
author | pjenvey <devnull@localhost> | 2007-02-18 02:46:32 +0000 |
---|---|---|
committer | pjenvey <devnull@localhost> | 2007-02-18 02:46:32 +0000 |
commit | d7fd8ee6dd91dbba56e63fe99e9bb462c7612620 (patch) | |
tree | c6c8e18b4ed67db8b5faf6ba831f0edefa8bad9b /paste/wsgiwrappers.py | |
parent | 69ed475bb3852b7ae48c6b729fabfbdb19b9e0e8 (diff) | |
download | paste-d7fd8ee6dd91dbba56e63fe99e9bb462c7612620.tar.gz |
added WSGIRequest.__repr__
Diffstat (limited to 'paste/wsgiwrappers.py')
-rw-r--r-- | paste/wsgiwrappers.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/paste/wsgiwrappers.py b/paste/wsgiwrappers.py index 1ea4ccf..905a9cf 100644 --- a/paste/wsgiwrappers.py +++ b/paste/wsgiwrappers.py @@ -7,6 +7,7 @@ to deal with an incoming request and sending a response. """ import re import warnings +from pprint import pformat from Cookie import SimpleCookie from paste.request import EnvironHeaders, get_cookie_dict, \ parse_dict_querystring, parse_formvars @@ -254,6 +255,25 @@ class WSGIRequest(object): return desired_matches(mimetypes, self.environ.get('HTTP_ACCEPT', '*/*')) + def __repr__(self): + """Show important attributes of the WSGIRequest""" + pf = pformat + msg = ['<%s.%s at 0x%x method=%s,' % \ + (self.__class__.__module__, self.__class__.__name__, + id(self), pf(self.method))] + msg.append('scheme=%s, host=%s, script_name=%s, path_info=%s,' % \ + (pf(self.scheme), pf(self.host), + pf(self.script_name), pf(self.path_info))) + charset_msg = '' + if self.charset: + charset_msg = ' charset=%s, errors=%s,' % \ + (pf(self.charset), pf(self.errors)) + msg.append('languges=%s,%s' % (pf(self.languages), charset_msg)) + msg.append('GET=%s,' % pf(self.GET)) + msg.append('POST=%s,' % pf(self.POST)) + msg.append('cookies=%s>' % pf(self.cookies)) + return '\n'.join(msg) + class WSGIResponse(object): """A basic HTTP response with content, headers, and out-bound cookies |