#NEWLINE# def _resolve_target( self , hostname , path ) : #NEWLINE# #INDENT# "Returns the module and instance that should handle this request.\n\n    Args:\n      hostname: A string containing the value of the host header in the request\n          or None if one was not present.\n      path: A string containing the path of the request.\n\n    Returns:\n      A tuple (_module, inst) where:\n        _module: The module.Module that should handle this request.\n        inst: The instance.Instance that should handle this request or None if\n            the module's load balancing should decide on the instance.\n\n    Raises:\n      request_info.ModuleDoesNotExistError: if hostname is not known.\n    " #NEWLINE# if ( self . _port == 80 ) : #NEWLINE# #INDENT# default_address = self . host #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# default_address = ( '%s:%s' % ( self . host , self . _port ) ) #NEWLINE# #UNINDENT# if ( ( not hostname ) or ( hostname == default_address ) ) : #NEWLINE# #INDENT# return ( self . _module_for_request ( path ) , None ) #NEWLINE# #UNINDENT# default_address_offset = hostname . find ( default_address ) #NEWLINE# if ( default_address_offset > 0 ) : #NEWLINE# #INDENT# prefix = hostname [ : ( default_address_offset - 1 ) ] #NEWLINE# if ( '.' in prefix ) : #NEWLINE# #INDENT# logging . warning ( 'Ignoring instance/version in %s; multiple versions are not supported in devappserver.' , prefix ) #NEWLINE# #UNINDENT# module_name = prefix . split ( '.' ) [ ( - 1 ) ] #NEWLINE# return ( self . _get_module_with_soft_routing ( module_name , None ) , None ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ':' in hostname ) : #NEWLINE# #INDENT# port = int ( hostname . split ( ':' , 1 ) [ 1 ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# port = 80 #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# ( _module , inst ) = self . _port_registry . get ( port ) #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# raise request_info . ModuleDoesNotExistError ( hostname ) #NEWLINE# #UNINDENT# #UNINDENT# if ( not _module ) : #NEWLINE# #INDENT# _module = self . _module_for_request ( path ) #NEWLINE# #UNINDENT# return ( _module , inst )