parameters: (request)
return_statement: return ''.join(location_parts)
docstring: Build WebSocket location for request.
docstring_summary: Build WebSocket location for request.
docstring_tokens: Build WebSocket location for request .
function: def _build_location(request):
      """Build WebSocket location for request."""
  
      location_parts = []
      if request.is_https():
          location_parts.append(common.WEB_SOCKET_SECURE_SCHEME)
      else:
          location_parts.append(common.WEB_SOCKET_SCHEME)
      location_parts.append('://')
      host, port = parse_host_header(request)
      connection_port = request.connection.local_addr[1]
      if port != connection_port:
          raise HandshakeException('Header/connection port mismatch: %d/%d' %
                                   (port, connection_port))
      location_parts.append(host)
      if (port != get_default_port(request.is_https())):
          location_parts.append(':')
          location_parts.append(str(port))
      location_parts.append(request.unparsed_uri)
      return ''.join(location_parts)
function_tokens: def _build_location ( request ) : location_parts = [ ] if request . is_https ( ) : location_parts . append ( common . WEB_SOCKET_SECURE_SCHEME ) else : location_parts . append ( common . WEB_SOCKET_SCHEME ) location_parts . append ( '://' ) host , port = parse_host_header ( request ) connection_port = request . connection . local_addr [ 1 ] if port != connection_port : raise HandshakeException ( 'Header/connection port mismatch: %d/%d' % ( port , connection_port ) ) location_parts . append ( host ) if ( port != get_default_port ( request . is_https ( ) ) ) : location_parts . append ( ':' ) location_parts . append ( str ( port ) ) location_parts . append ( request . unparsed_uri ) return '' . join ( location_parts )