#NEWLINE# @ tornado . gen . coroutine #NEWLINE# def find_location_players( self , iid , locid ) : #NEWLINE# #INDENT# 'Generates a list of players in a given location. If locid\n        is None, generates a list of players in the entire instance.\n        ' #NEWLINE# if locid : #NEWLINE# #INDENT# cursor = self . app . mongodb . playstate . find ( { #NEWLINE# #INDENT# 'iid' : iid , #NEWLINE# 'locid' : locid , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# '_id' : 1 , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# cursor = self . app . mongodb . playstate . find ( { #NEWLINE# #INDENT# 'iid' : locid , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# '_id' : 1 , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# people = [ ] #NEWLINE# while ( yield cursor . fetch_next ) : #NEWLINE# #INDENT# ostate = cursor . next_object ( ) #NEWLINE# people . append ( ostate [ '_id' ] ) #NEWLINE# #UNINDENT# return people