python: Consistently use from…import for urllib.parse.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2023-12-05 12:14:17 -08:00
committed by Tim Abbott
parent e5d71fe5ac
commit 3853fa875a
27 changed files with 154 additions and 210 deletions

View File

@@ -1,6 +1,5 @@
import base64
import logging
import urllib
from datetime import datetime
from functools import wraps
from io import BytesIO
@@ -16,6 +15,7 @@ from typing import (
cast,
overload,
)
from urllib.parse import urlparse
import django_otp
from django.conf import settings
@@ -393,8 +393,8 @@ def zulip_redirect_to_login(
resolved_login_url = resolve_url(login_url or settings.LOGIN_URL)
# If the login URL is the same scheme and net location then just
# use the path as the "next" url.
login_scheme, login_netloc = urllib.parse.urlparse(resolved_login_url)[:2]
current_scheme, current_netloc = urllib.parse.urlparse(path)[:2]
login_scheme, login_netloc = urlparse(resolved_login_url)[:2]
current_scheme, current_netloc = urlparse(path)[:2]
if (not login_scheme or login_scheme == current_scheme) and (
not login_netloc or login_netloc == current_netloc
):