#NEWLINE# def iter_choices( self , pad , record = None , alt = PRIMARY_ALT ) : #NEWLINE# #INDENT# values = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if ( record is not None ) : #NEWLINE# #INDENT# values [ 'record' ] = record #NEWLINE# #UNINDENT# if ( self . choices is not None ) : #NEWLINE# #INDENT# iterable = self . choices #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# iterable = self . source . evaluate ( pad , alt = alt , values = values ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# traceback . print_exc ( ) #NEWLINE# iterable = ( ) #NEWLINE# #UNINDENT# #UNINDENT# for item in ( iterable or ( ) ) : #NEWLINE# #INDENT# key = self . item_key . evaluate ( pad , this = item , alt = alt , values = values ) #NEWLINE# if ( self . item_label is not None ) : #NEWLINE# #INDENT# label = { #NEWLINE# #INDENT# 'en' : self . item_label . evaluate ( pad , this = item , alt = alt , values = values ) , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( isinstance ( item , ( tuple , list ) ) and ( len ( item ) == 2 ) ) : #NEWLINE# #INDENT# label = item [ 1 ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if hasattr ( item , 'get_record_label_i18n' ) : #NEWLINE# #INDENT# label = item . get_record_label_i18n ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# label = { #NEWLINE# #INDENT# 'en' : item [ '_id' ] , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# ( yield ( key , label ) )