#NEWLINE# def get_by_ids( model , uids ) : #NEWLINE# #INDENT# if ( not len ( uids ) ) : #NEWLINE# #INDENT# return { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# if ( len ( uids ) == 1 ) : #NEWLINE# #INDENT# data = model . query . get ( uids . pop ( ) ) #NEWLINE# return { #NEWLINE# #INDENT# data . id : uids , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# data = model . query . filter ( model . id . in_ ( uids ) ) . all ( ) #NEWLINE# ret = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for item in data : #NEWLINE# #INDENT# ret [ item . id ] = item #NEWLINE# #UNINDENT# return ret