def clear_middleware(app):
 def clear_throw_errors(environ, start_response):
  headers_sent = []
  def replacement(status, headers, exc_info=None):
   if headers_sent:
    return start_response(status, headers, exc_info)
   headers_sent.append(True)
   return start_response(status, headers)
  if ('paste.throw_errors' in environ):
   del environ['paste.throw_errors']
  return app(environ, replacement)
 return clear_throw_errors

def clear_middleware ( app ) : def clear_throw_errors ( environ , start_response ) : headers_sent = [ ] def replacement ( status , headers , exc_info = None ) : if headers_sent : return start_response ( status , headers , exc_info ) headers_sent . append ( True ) return start_response ( status , headers ) if ( 'paste.throw_errors' in environ ) : del environ [ 'paste.throw_errors' ] return app ( environ , replacement ) return clear_throw_errors
the fixture sets paste .