예제 #1
0
 def build_absolute_uri(self, location=None):
     """
     Builds an absolute URI from the location and the variables available in
     this request. If no location is specified, the absolute URI is built on
     ``request.get_full_path()``.
     """
     if not location:
         location = self.get_full_path()
     if not absolute_http_url_re.match(location):
         current_uri = '%s://%s%s' % (self.is_secure and 'https' or 'http',
                                      self.get_host(), self.path)
         location = urljoin(current_uri, location)
     return iri_to_uri(location)
예제 #2
0
 def build_absolute_uri(self, location=None):
     """
     Builds an absolute URI from the location and the variables available in
     this request. If no location is specified, the absolute URI is built on
     ``request.get_full_path()``.
     """
     if not location:
         location = self.get_full_path()
     if not absolute_http_url_re.match(location):
         current_uri = '%s://%s%s' % (self.is_secure and 'https'
                                      or 'http', self.get_host(), self.path)
         location = urljoin(current_uri, location)
     return iri_to_uri(location)
예제 #3
0
 def absolute_path(self, path, prefix=None):
     if path.startswith('http://') or path.startswith('https://')\
      or path.startswith('/'):
         return path
     return urljoin(prefix, path)
예제 #4
0
 def absolute_path(self, path, prefix=None):
     if path.startswith("http://") or path.startswith("https://") or path.startswith("/"):
         return path
     return urljoin(prefix, path)