#NEWLINE# def get_query_string( self , new_params = None , remove = None ) : #NEWLINE# #INDENT# if ( new_params is None ) : #NEWLINE# #INDENT# new_params = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# if ( remove is None ) : #NEWLINE# #INDENT# remove = [ ] #NEWLINE# #UNINDENT# p = self . params . copy ( ) #NEWLINE# for r in remove : #NEWLINE# #INDENT# for k in list ( p ) : #NEWLINE# #INDENT# if k . startswith ( r ) : #NEWLINE# #INDENT# del p [ k ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# for ( k , v ) in new_params . items ( ) : #NEWLINE# #INDENT# if ( v is None ) : #NEWLINE# #INDENT# if ( k in p ) : #NEWLINE# #INDENT# del p [ k ] #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# p [ k ] = p #NEWLINE# #UNINDENT# #UNINDENT# return ( '?%s' % urlencode ( sorted ( p . items ( ) ) ) )