#NEWLINE# def write( self , data ) : #NEWLINE# #INDENT# "'write()' callable as specified by PEP 3333" #NEWLINE# assert isinstance ( data , bytes ) , 'write() argument must be bytestring' #NEWLINE# if ( not self . status ) : #NEWLINE# #INDENT# raise AssertionError ( 'write() before start_response()' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not self . headers_sent ) : #NEWLINE# #INDENT# self . bytes_sent = len ( data ) #NEWLINE# self . send_headers ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . bytes_sent += len ( data ) #NEWLINE# #UNINDENT# #UNINDENT# data = BytesIO ( data ) #NEWLINE# for chunk in iter ( ( lambda : data . read ( MAX_SOCKET_CHUNK_SIZE ) ) , b'' ) : #NEWLINE# #INDENT# self . _write ( data ) #NEWLINE# self . _flush ( )