Example #1
0
def build_rest_uri(request, handler, 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()``.
    """
    current_uri = '%s://%s%s' % (request.is_secure() and 'https'
                                 or 'http', request.get_host(), request.path)

    if not location:
        location = current_uri
    else:
        location = urljoin(current_uri, location)
    return iri_to_uri(location)
Example #2
0
def build_rest_uri(request, handler, 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()``.
    """
    current_uri = '%s://%s%s' % (request.is_secure() and 'https' or 'http',
                                     request.get_host(), request.path)
    
    if not location:
        location = current_uri
    else:
        location = urljoin(current_uri, location)
    return iri_to_uri(location)
Example #3
0
 def __init__(self, redirect_to):
     HttpResponse.__init__(self)
     self['Location'] = iri_to_uri(redirect_to)
Example #4
0
 def __init__(self, redirect_to):
     super(HttpResponse, self).__init__()
     self['Location'] = iri_to_uri(redirect_to)