Changeset 617
- Timestamp:
- 09/08/05 19:02:26
- Files:
-
- trunk/cherrypy/_cputil.py (modified) (3 diffs)
- trunk/cherrypy/test/test_core.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/_cputil.py
r606 r617 35 35 import time 36 36 import os 37 import os.path 37 #import os.path 38 38 39 import cherrypy 40 from cherrypy.lib import httperrors 39 41 40 42 … … 151 153 f.close() 152 154 153 from cherrypy.lib import httperrors154 155 155 def _cpOnHTTPError(): 156 156 """ Default _cpOnHTTPError method """ 157 157 status, customMessage = sys.exc_info()[1].getArgs() 158 158 159 # get the error mage159 # get the error page 160 160 page = httperrors.getErrorPage(status, customMessage = customMessage) 161 161 cherrypy.response.status, cherrypy.response.body = page … … 176 176 showTracebacks = cherrypy.config.get('server.showTracebacks') 177 177 178 logTracebacks = cherrypy.config.get('server.logTracebacks') 179 if logTracebacks: 180 cherrypy.log(formatExc()) 181 178 182 response = cherrypy.response 179 183 180 184 if not developmentMode and httpErrors: 181 185 # if it isn't development mode and http errors are turned on 182 # set the respo se status and render the body186 # set the response status and render the body 183 187 if response.status == 404: 184 188 response.status, response.body = httperrors.getErrorPage(404) trunk/cherrypy/test/test_core.py
r605 r617 272 272 'server.logFile': logFile, 273 273 }, 274 '/error': { 275 'server.logFile': logFile, 276 'server.logTracebacks': True, 277 }, 274 278 }) 275 279 … … 392 396 data = open(logFile, "rb").readlines() 393 397 self.assertEqual(data[0][-53:], ' HTTP INFO 127.0.0.1 - GET /params/?thing=a HTTP/1.1\n') 398 399 # Test that tracebacks get written to the error log. 400 ignore = helper.webtest.ignored_exceptions 401 ignore.append(ValueError) 402 try: 403 self.getPage("/error/page_method") 404 self.assertInBody("raise ValueError()") 405 data = open(logFile, "rb").readlines() 406 self.assertEqual(data[2][-41:], ' INFO Traceback (most recent call last):\n') 407 self.assertEqual(data[8], ' raise ValueError()\n') 408 finally: 409 ignore.pop() 394 410 395 411 def testRedirect(self):

