#NEWLINE# def _clean_req( self , request , method , results ) : #NEWLINE# #INDENT# ' stop the request from returning objects and records any errors ' #NEWLINE# cb = method . callback #NEWLINE# @ wraps ( cb ) #NEWLINE# def cb_wrapper( response ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# output = cb ( response ) #NEWLINE# output = list ( iterate_spider_output ( output ) ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# case = _create_testcase ( method , 'callback' ) #NEWLINE# results . addError ( case , sys . exc_info ( ) ) #NEWLINE# #UNINDENT# #UNINDENT# def eb_wrapper( failure ) : #NEWLINE# #INDENT# case = _create_testcase ( method , 'errback' ) #NEWLINE# exc_info = ( failure . value , failure . type , failure . getTracebackObject ( ) ) #NEWLINE# results . addError ( case , exc_info ) #NEWLINE# #UNINDENT# request . callback = cb_wrapper #NEWLINE# request . errback = eb_wrapper