#NEWLINE# def write( self , data ) : #NEWLINE# #INDENT# self . hashsum . update ( data ) #NEWLINE# self . len_so_far += len ( data ) #NEWLINE# if ( self . len_so_far > self . length_getter ( ) ) : #NEWLINE# #INDENT# self . finished_cb ( self , Failure ( InvalidDataError ( ( 'Length so far is greater than the expected length. %s to %s' % ( str ( self . len_so_far ) , str ( self . length_getter ( ) ) ) ) ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . write_handle is None ) : #NEWLINE# #INDENT# log . debug ( 'Tried to write to a write_handle that was None.' ) #NEWLINE# return #NEWLINE# #UNINDENT# self . write_handle . write ( data ) #NEWLINE# if ( self . len_so_far == self . length_getter ( ) ) : #NEWLINE# #INDENT# self . finished_cb ( self )