Source

CherryPy / cherrypy / _cphttptools.py

Diff from to

cherrypy/_cphttptools.py

                     inst.set_response()
                     applyFilters('beforeFinalize')
                     finalize()
+                except cherrypy.HTTPError, inst:
+                    # This includes NotFound
+                    inst.set_response()
+                    applyFilters('beforeFinalize')
+                    finalize()
+
             finally:
                 applyFilters('onEndResource')
         except:
     try:
         applyFilters('beforeErrorResponse')
        
-        # status, body may already be set by HTTPError constructor
-        if not isinstance(exc, cherrypy.HTTPError):
-            # _cpOnError will probably change cherrypy.response.body.
-            # It may also change the headerMap, etc.
-            _cputil.getSpecialAttribute('_cpOnError')()
+        # _cpOnError will probably change cherrypy.response.body.
+        # It may also change the headerMap, etc.
+        _cputil.getSpecialAttribute('_cpOnError')()
         
         finalize()