def handle_no_permission(self):
    if self.raise_exception:
        raise PermissionDenied(self.get_permission_denied_message())
    path = self.request.build_absolute_uri()
    resolved_gate_url = resolve_url(self.get_gate_url())
    (gate_scheme, gate_netloc) = urlparse(resolved_gate_url)[:2]
    (current_scheme, current_netloc) = urlparse(path)[:2]
    if (((not gate_scheme) or (gate_scheme == current_scheme)) and ((not gate_netloc) or (gate_netloc == current_netloc))):
        path = self.request.get_full_path()
    return redirect_to_gate(path, resolved_gate_url, self.get_redirect_field_name())
def handle_no_permission(self):
    if self.raise_exception:
        raise PermissionDenied(self.get_permission_denied_message())
    path = self.request.build_absolute_uri()
    resolved_gate_url = resolve_url(self.get_gate_url())
    (gate_scheme, gate_netloc) = urlparse(resolved_gate_url)[:2]
    (current_scheme, current_netloc) = urlparse(path)[:2]
    if (((not gate_scheme) or (gate_scheme == current_scheme)) and ((not gate_netloc) or (gate_netloc == current_netloc))):
        path = self.request.get_full_path()
    return redirect_to_gate(path, resolved_gate_url, self.get_redirect_field_name())