Changeset 770
- Timestamp:
- 10/31/05 13:34:53
- Files:
-
- trunk/cherrypy/_cperror.py (modified) (4 diffs)
- trunk/cherrypy/test/test_core.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/_cperror.py
r768 r770 61 61 if request.queryString: 62 62 request.browserUrl += '?' + request.queryString 63 64 Exception.__init__(self, path, params) 63 65 64 66 … … 105 107 106 108 self.status = status 109 Exception.__init__(self, abs_urls, status) 107 110 108 111 def set_response(self): … … 157 160 raise ValueError("status must be between 400 and 599.") 158 161 self.message = message 162 Error.__init__(self, status, message) 159 163 160 164 def set_response(self): … … 177 181 if cherrypy.response.headerMap.has_key("Content-Encoding"): 178 182 del cherrypy.response.headerMap['Content-Encoding'] 179 180 def __str__(self):181 import cherrypy182 return "%s: %s" % (self.status, self.message or "")183 183 184 184 trunk/cherrypy/test/test_core.py
r768 r770 80 80 class Redirect(Test): 81 81 82 def _cpOnError(self): 83 raise cherrypy.HTTPRedirect("/errpage") 84 85 def error(self): 86 raise NameError() 82 class Error: 83 def _cpOnError(self): 84 raise cherrypy.HTTPRedirect("/errpage") 85 86 def index(self): 87 raise NameError() 88 index.exposed = True 89 error = Error() 87 90 88 91 def index(self): … … 112 115 else: 113 116 raise cherrypy.InternalRedirect('/image/getImagesByUser') 117 118 def stringify(self): 119 return str(cherrypy.HTTPRedirect("/")) 114 120 115 121 … … 504 510 505 511 # HTTPRedirect on error 506 self.getPage("/redirect/error ")512 self.getPage("/redirect/error/") 507 513 self.assertStatus('303 See Other') 508 514 self.assertInBody('/errpage') 515 516 # Make sure str(HTTPRedirect()) works. 517 self.getPage("/redirect/stringify") 518 self.assertStatus('200 OK') 519 self.assertBody("(['http://127.0.0.1:8000/'], 303)") 509 520 510 521 def testCPFilterList(self):

