#NEWLINE# def handle( self , input ) : #NEWLINE# #INDENT# result = OrderedDict ( ) #NEWLINE# query = None #NEWLINE# orderby = None #NEWLINE# if ( ( input is not None ) and input . has_key ( 'op' ) ) : #NEWLINE# #INDENT# if ( input [ 'op' ] == 'query' ) : #NEWLINE# #INDENT# if input [ 'query' ] . has_key ( '$query' ) : #NEWLINE# #INDENT# query = input [ 'query' ] [ '$query' ] #NEWLINE# if input [ 'query' ] . has_key ( '$orderby' ) : #NEWLINE# #INDENT# orderby = input [ 'query' ] [ '$orderby' ] #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# query = input [ 'query' ] #NEWLINE# #UNINDENT# result [ 'ns' ] = input [ 'ns' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( input [ 'op' ] == 'update' ) : #NEWLINE# #INDENT# query = input [ 'query' ] #NEWLINE# if input . has_key ( 'updateobj' ) : #NEWLINE# #INDENT# if input [ 'updateobj' ] . has_key ( 'orderby' ) : #NEWLINE# #INDENT# orderby = input [ 'updateobj' ] [ 'orderby' ] #NEWLINE# #UNINDENT# #UNINDENT# result [ 'ns' ] = input [ 'ns' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( input [ 'op' ] == 'command' ) and ( input [ 'command' ] . has_key ( 'count' ) or input [ 'command' ] . has_key ( 'findAndModify' ) ) ) : #NEWLINE# #INDENT# query = input [ 'command' ] [ 'query' ] #NEWLINE# db = input [ 'ns' ] [ 0 : input [ 'ns' ] . rfind ( '.' ) ] #NEWLINE# result [ 'ns' ] = ( ( db + '.' ) + input [ 'command' ] [ 'count' ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# toMask = OrderedDict ( ) #NEWLINE# if ( orderby is not None ) : #NEWLINE# #INDENT# result [ 'orderby' ] = orderby #NEWLINE# toMask [ '$orderby' ] = orderby #NEWLINE# #UNINDENT# result [ 'query' ] = scrub ( query ) #NEWLINE# toMask [ '$query' ] = query #NEWLINE# result [ 'queryMask' ] = small_json ( toMask ) #NEWLINE# result [ 'stats' ] = { #NEWLINE# #INDENT# 'millis' : input [ 'millis' ] , #NEWLINE# #UNINDENT# } #NEWLINE# return result #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return None