Commits

Anonymous committed f23217c

implimented fumanchus final suggestions for ticket:288

  • Participants
  • Parent commits 5382c0b

Comments (0)

Files changed (2)

File cherrypy/_cphttptools.py

     """Set status, headers, and body when an error occurs."""
     try:
         applyFilters('beforeErrorResponse')
-        
-        # _cpOnError will probably change cherrypy.response.body.
-        # They may also change the headerMap, etc.
-        _cputil.getSpecialAttribute('_cpOnError')()
+       
+        if isinstance(sys.exc_info()[1], cherrypy.HTTPError):
+            # status, body already set by HTTPError constructor
+            pass
+        else:
+            # _cpOnError will probably change cherrypy.response.body.
+            # They may also change the headerMap, etc.
+            _cputil.getSpecialAttribute('_cpOnError')()
         
         finalize()
         

File cherrypy/_cputil.py

     
     response = cherrypy.response
     
-    if isinstance(sys.exc_info()[1], cherrypy.HTTPError):
-        # status, body already set
-        pass
-    else:
-        response.status, response.body = getErrorStatusAndPage(500)
+    response.status, response.body = getErrorStatusAndPage(500)
     
     if cherrypy.response.headerMap.has_key('Content-Encoding'):
         del cherrypy.response.headerMap['Content-Encoding']