def _is_fetching_self(url, method):
 if ((method != GET) or ('HTTP_HOST' not in os.environ) or ('PATH_INFO' not in os.environ)):
  return False
 (scheme, host_port, path, query, fragment) = urlparse.urlsplit(url)
 if (host_port == os.environ['HTTP_HOST']):
  current_path = urllib2.unquote(os.environ['PATH_INFO'])
  desired_path = urllib2.unquote(path)
  if ((current_path == desired_path) or ((current_path in ('', '/')) and (desired_path in ('', '/')))):
   return True
 return False

def _is_fetching_self ( url , method ) : if ( ( method != GET ) or ( 'HTTP_HOST' not in os . environ ) or ( 'PATH_INFO' not in os . environ ) ) : return False ( scheme , host_port , path , query , fragment ) = urlparse . urlsplit ( url ) if ( host_port == os . environ [ 'HTTP_HOST' ] ) : current_path = urllib2 . unquote ( os . environ [ 'PATH_INFO' ] ) desired_path = urllib2 . unquote ( path ) if ( ( current_path == desired_path ) or ( ( current_path in ( '' , '/' ) ) and ( desired_path in ( '' , '/' ) ) ) ) : return True return False
checks if the fetch is for the same url from which it originated .