#NEWLINE# def filter( self , script_name , path_info , environ , status , headers , body ) : #NEWLINE# #INDENT# topdf = environ . get ( 'pisa.topdf' , '' ) #NEWLINE# if topdf : #NEWLINE# #INDENT# dst = StringIO . StringIO ( ) #NEWLINE# pisa . CreatePDF ( body , dst , show_error_as_pdf = True ) #NEWLINE# headers = [ ( 'content-type' , 'application/pdf' ) , ( 'content-disposition' , ( 'attachment; filename=' + topdf ) ) ] #NEWLINE# body = dst . getvalue ( ) #NEWLINE# #UNINDENT# return ( path_info , headers , body )