#NEWLINE# def handleRecord( self , schema , datum ) : #NEWLINE# #INDENT# if ( not isinstance ( datum , dict ) ) : #NEWLINE# #INDENT# return datum #NEWLINE# #UNINDENT# dic = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# datumKeys = set ( datum . keys ( ) ) #NEWLINE# requiredFields = getattr ( protocol , schema . name ) . requiredFields #NEWLINE# for field in schema . fields : #NEWLINE# #INDENT# key = field . name #NEWLINE# if ( key in datum ) : #NEWLINE# #INDENT# value = datum . get ( key ) #NEWLINE# result = self . handleSchema ( field . type , value ) #NEWLINE# if ( result != self . sinkValue ) : #NEWLINE# #INDENT# dic [ key ] = result #NEWLINE# #UNINDENT# datumKeys . remove ( key ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( key in requiredFields ) : #NEWLINE# #INDENT# dic [ key ] = datum . missingValue #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if len ( datumKeys ) : #NEWLINE# #INDENT# for key in datumKeys : #NEWLINE# #INDENT# dic [ key ] = self . extraValue #NEWLINE# #UNINDENT# #UNINDENT# if len ( dic ) : #NEWLINE# #INDENT# return dic #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return self . sinkValue