def _host_url_property():
 def getter(self):
  if ('HTTP_HOST' in self.environ):
   host = self.environ['HTTP_HOST']
  else:
   host = ('%s:%s' % (self.environ['SERVER_NAME'], self.environ['SERVER_PORT']))
  scheme = self.environ.get('wsgi.url_scheme', 'http')
  if ((scheme == 'http') and host.endswith(':80')):
   (host, port) = host.rsplit(':', 1)
  elif ((scheme == 'https') and host.endswith(':443')):
   (host, port) = host.rsplit(':', 1)
  return ('%s://%s' % (scheme, host))
 return property(getter, doc='Get url for request/response up to path')

def _host_url_property ( ) : def getter ( self ) : if ( 'HTTP_HOST' in self . environ ) : host = self . environ [ 'HTTP_HOST' ] else : host = ( '%s:%s' % ( self . environ [ 'SERVER_NAME' ] , self . environ [ 'SERVER_PORT' ] ) ) scheme = self . environ . get ( 'wsgi.url_scheme' , 'http' ) if ( ( scheme == 'http' ) and host . endswith ( ':80' ) ) : ( host , port ) = host . rsplit ( ':' , 1 ) elif ( ( scheme == 'https' ) and host . endswith ( ':443' ) ) : ( host , port ) = host . rsplit ( ':' , 1 ) return ( '%s://%s' % ( scheme , host ) ) return property ( getter , doc = 'Get url for request/response up to path' )
retrieves the best guess that can be made for an absolute location up to the path .