#NEWLINE# def _screenargs( kargs , mapper , environ , force_explicit = False ) : #NEWLINE# #INDENT# '\n    Private function that takes a dict, and screens it against the current\n    request dict to determine what the dict should look like that is used.\n    This is responsible for the requests "memory" of the current.\n    ' #NEWLINE# encoding = mapper . encoding #NEWLINE# for ( key , val ) in six . iteritems ( kargs ) : #NEWLINE# #INDENT# if isinstance ( val , six . text_type ) : #NEWLINE# #INDENT# kargs [ key ] = val . encode ( encoding ) #NEWLINE# #UNINDENT# #UNINDENT# if ( mapper . explicit and mapper . sub_domains and ( not force_explicit ) ) : #NEWLINE# #INDENT# return _subdomain_check ( kargs , mapper , environ ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( mapper . explicit and ( not force_explicit ) ) : #NEWLINE# #INDENT# return kargs #NEWLINE# #UNINDENT# #UNINDENT# controller_name = as_unicode ( kargs . get ( 'controller' ) , encoding ) #NEWLINE# if ( controller_name and controller_name . startswith ( '/' ) ) : #NEWLINE# #INDENT# kargs [ 'controller' ] = kargs [ 'controller' ] [ 1 : ] #NEWLINE# return kargs #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( controller_name and ( 'action' not in kargs ) ) : #NEWLINE# #INDENT# kargs [ 'action' ] = 'index' #NEWLINE# #UNINDENT# #UNINDENT# route_args = environ . get ( 'wsgiorg.routing_args' ) #NEWLINE# if route_args : #NEWLINE# #INDENT# memory_kargs = route_args [ 1 ] . copy ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# memory_kargs = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# empty_keys = [ key for ( key , value ) in six . iteritems ( kargs ) if ( value is None ) ] #NEWLINE# for key in empty_keys : #NEWLINE# #INDENT# del route_args [ key ] #NEWLINE# memory_kargs . pop ( key , None ) #NEWLINE# #UNINDENT# memory_kargs . update ( kargs ) #NEWLINE# if mapper . sub_domains : #NEWLINE# #INDENT# memory_kargs = _subdomain_check ( memory_kargs , mapper , environ ) #NEWLINE# #UNINDENT# return memory_kargs