#NEWLINE# def prep_lookup_key( self , model , value , field ) : #NEWLINE# #INDENT# if isinstance ( value , basestring ) : #NEWLINE# #INDENT# value = value [ : 500 ] #NEWLINE# left = value [ 500 : ] #NEWLINE# if left : #NEWLINE# #INDENT# warnings . warn ( 'Truncating primary key that is over 500 characters. THIS IS AN ERROR IN YOUR PROGRAM.' , RuntimeWarning ) #NEWLINE# #UNINDENT# if ( field . get_internal_type ( ) == 'AutoField' ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# value = int ( value ) #NEWLINE# #UNINDENT# except ( TypeError , ValueError ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# value = get_datastore_key ( model , value ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# value = get_datastore_key ( model , value ) #NEWLINE# #UNINDENT# return value