#NEWLINE# def do_handle( self , input ) : #NEWLINE# #INDENT# match = self . _rx . match ( input ) #NEWLINE# if ( result is not None ) : #NEWLINE# #INDENT# parsed = self . parse_query ( match . group ( 'query' ) ) #NEWLINE# if ( parsed is not None ) : #NEWLINE# #INDENT# result = OrderedDict ( ) #NEWLINE# result [ 'stats' ] = self . parse_line_stats ( match . group ( 'stats' ) ) #NEWLINE# result [ 'stats' ] [ 'millis' ] = match . group ( 'query_time' ) #NEWLINE# command = parsed . keys ( ) [ 0 ] #NEWLINE# toMask = OrderedDict ( ) #NEWLINE# result [ 'command' ] = command #NEWLINE# result [ 'supported' ] = True #NEWLINE# if ( command . lower ( ) == 'count' ) : #NEWLINE# #INDENT# result [ 'ns' ] = ( match . group ( 'db' ) + '.' ) #NEWLINE# result [ 'ns' ] += parsed [ command ] #NEWLINE# query = self . standardize_query ( parsed [ 'query' ] ) #NEWLINE# result [ 'query' ] = query [ '$query' ] #NEWLINE# toMask = query #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( command . lower ( ) == 'findandmodify' ) : #NEWLINE# #INDENT# if ( 'sort' in parsed ) : #NEWLINE# #INDENT# result [ 'orderby' ] = parsed [ 'sort' ] #NEWLINE# toMask [ '$orderby' ] = parsed [ 'sort' ] #NEWLINE# #UNINDENT# result [ 'ns' ] = ( match . group ( 'db' ) + '.' ) #NEWLINE# result [ 'ns' ] += parsed [ command ] #NEWLINE# query = self . standardize_query ( parsed [ 'query' ] ) #NEWLINE# result [ 'query' ] = query [ '$query' ] #NEWLINE# if ( 'sort' in parsed ) : #NEWLINE# #INDENT# result [ 'orderby' ] = parsed [ 'sort' ] #NEWLINE# toMask [ '$orderby' ] = parsed [ 'sort' ] #NEWLINE# #UNINDENT# toMask [ '$query' ] = query #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( command . lower ( ) == 'geonear' ) : #NEWLINE# #INDENT# result [ 'ns' ] = ( match . group ( 'db' ) + '.' ) #NEWLINE# result [ 'ns' ] += parsed [ command ] #NEWLINE# query = self . standardize_query ( parsed [ 'search' ] ) #NEWLINE# result [ 'query' ] = query #NEWLINE# toMask = query #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# result [ 'supported' ] = False #NEWLINE# result [ 'ns' ] = ( match . group ( 'db' ) + '.$cmd' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# result [ 'command' ] = command #NEWLINE# toMask [ '$cmd' ] = command #NEWLINE# result [ 'queryMask' ] = small_json ( toMask ) #NEWLINE# return result #NEWLINE# #UNINDENT# #UNINDENT# return None