#NEWLINE# def prep_lookup_value( self , model , value , field , column = None ) : #NEWLINE# #INDENT# if ( field . primary_key and ( ( not db_type ) or ( column == model . _meta . pk . column ) ) ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# return self . prep_lookup_key ( model , value , field ) #NEWLINE# #UNINDENT# except datastore_errors . BadValueError : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# #UNINDENT# db_type = field . db_type ( self . connection ) #NEWLINE# if ( db_type == 'date' ) : #NEWLINE# #INDENT# return self . prep_lookup_date ( model , value , field ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( db_type == 'time' ) : #NEWLINE# #INDENT# return self . prep_lookup_time ( model , value , field ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( db_type in ( 'list' , 'set' ) ) : #NEWLINE# #INDENT# if ( hasattr ( value , '__len__' ) and ( not value ) ) : #NEWLINE# #INDENT# value = None #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if hasattr ( value , '__iter__' ) : #NEWLINE# #INDENT# value = list ( value ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return value