* Revert "chore: move function to correct file" This reverts commitebfdfa283b. * Revert "refactor!: merge get_site_url into get_url (#22308)" This reverts commit2001bc278f.
This commit is contained in:
parent
39c06cffcd
commit
970a740164
11 changed files with 20 additions and 18 deletions
|
|
@ -17,6 +17,7 @@ import inspect
|
|||
import json
|
||||
import os
|
||||
import re
|
||||
import unicodedata
|
||||
import warnings
|
||||
from collections.abc import Callable
|
||||
from typing import TYPE_CHECKING, Any, Literal, Optional, TypeAlias, overload
|
||||
|
|
|
|||
|
|
@ -1101,7 +1101,7 @@ def browse(context, site, user=None):
|
|||
else:
|
||||
click.echo("Please enable developer mode to login as a user")
|
||||
|
||||
url = f"{frappe.utils.get_url()}{sid}"
|
||||
url = f"{frappe.utils.get_site_url(site)}{sid}"
|
||||
|
||||
if user == "Administrator":
|
||||
click.echo(f"Login URL: {url}")
|
||||
|
|
|
|||
|
|
@ -865,7 +865,7 @@ def run_ui_tests(
|
|||
site = get_site(context)
|
||||
frappe.init(site)
|
||||
app_base_path = frappe.get_app_source_path(app)
|
||||
site_url = frappe.utils.get_url(site)
|
||||
site_url = frappe.utils.get_site_url(site)
|
||||
admin_password = frappe.get_conf(site).admin_password
|
||||
|
||||
# override baseUrl using env variable
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ from frappe.core.doctype.user.user import generate_keys
|
|||
|
||||
# imports - standard imports
|
||||
from frappe.tests.utils import FrappeTestCase
|
||||
from frappe.utils import cstr, get_url
|
||||
from frappe.utils import cstr, get_site_url
|
||||
|
||||
|
||||
class TestAccessLog(FrappeTestCase):
|
||||
|
|
@ -154,7 +154,7 @@ class TestAccessLog(FrappeTestCase):
|
|||
new_private_file.insert()
|
||||
|
||||
# access the created file
|
||||
private_file_link = get_url() + new_private_file.file_url
|
||||
private_file_link = get_site_url(frappe.local.site) + new_private_file.file_url
|
||||
|
||||
try:
|
||||
request = requests.post(private_file_link, headers=self.header)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import frappe
|
|||
from frappe.core.doctype.scheduled_job_type.scheduled_job_type import sync_jobs
|
||||
from frappe.frappeclient import FrappeClient, FrappeException
|
||||
from frappe.tests.utils import FrappeTestCase
|
||||
from frappe.utils import get_url
|
||||
from frappe.utils import get_site_url
|
||||
|
||||
scripts = [
|
||||
dict(
|
||||
|
|
@ -122,7 +122,7 @@ class TestServerScript(FrappeTestCase):
|
|||
)
|
||||
|
||||
def test_api(self):
|
||||
response = requests.post(get_url() + "/api/method/test_server_script")
|
||||
response = requests.post(get_site_url(frappe.local.site) + "/api/method/test_server_script")
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual("hello", response.json()["message"])
|
||||
|
||||
|
|
@ -267,7 +267,7 @@ frappe.qb.from_(todo).select(todo.name).where(todo.name == "{todo.name}").run()
|
|||
|
||||
frappe.db.commit()
|
||||
|
||||
site = frappe.utils.get_url()
|
||||
site = frappe.utils.get_site_url(frappe.local.site)
|
||||
client = FrappeClient(site)
|
||||
|
||||
# Exhaust rate limit
|
||||
|
|
|
|||
|
|
@ -3,5 +3,5 @@ import frappe
|
|||
|
||||
def execute():
|
||||
frappe.reload_doc("website", "doctype", "web_page_view", force=True)
|
||||
site_url = frappe.utils.get_url()
|
||||
site_url = frappe.utils.get_site_url(frappe.local.site)
|
||||
frappe.db.sql(f"""UPDATE `tabWeb Page View` set is_unique=1 where referrer LIKE '%{site_url}%'""")
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ from werkzeug.test import TestResponse
|
|||
import frappe
|
||||
from frappe.installer import update_site_config
|
||||
from frappe.tests.utils import FrappeTestCase, patch_hooks
|
||||
from frappe.utils import get_test_client, get_url
|
||||
from frappe.utils import get_site_url, get_test_client
|
||||
|
||||
try:
|
||||
_site = frappe.local.site
|
||||
|
|
@ -73,7 +73,7 @@ class ThreadWithReturnValue(Thread):
|
|||
|
||||
class FrappeAPITestCase(FrappeTestCase):
|
||||
SITE = frappe.local.site
|
||||
SITE_URL = get_url()
|
||||
SITE_URL = get_site_url(SITE)
|
||||
RESOURCE_URL = f"{SITE_URL}/api/resource"
|
||||
TEST_CLIENT = get_test_client()
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ from frappe.frappeclient import AuthError, FrappeClient
|
|||
from frappe.sessions import Session, get_expired_sessions, get_expiry_in_seconds
|
||||
from frappe.tests.test_api import FrappeAPITestCase
|
||||
from frappe.tests.utils import FrappeTestCase
|
||||
from frappe.utils import get_url, now
|
||||
from frappe.utils import get_site_url, now
|
||||
from frappe.utils.data import add_to_date
|
||||
from frappe.www.login import _generate_temporary_login_link
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ class TestAuth(FrappeTestCase):
|
|||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
cls.HOST_NAME = get_url()
|
||||
cls.HOST_NAME = frappe.get_site_config().host_name or get_site_url(frappe.local.site)
|
||||
cls.test_user_email = "test_auth@test.com"
|
||||
cls.test_user_name = "test_auth_user"
|
||||
cls.test_user_mobile = "+911234567890"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ from unittest.mock import patch
|
|||
|
||||
import frappe
|
||||
from frappe.tests.utils import FrappeTestCase
|
||||
from frappe.utils import get_url
|
||||
from frappe.utils import get_site_url
|
||||
|
||||
|
||||
class TestClient(FrappeTestCase):
|
||||
|
|
@ -135,7 +135,7 @@ class TestClient(FrappeTestCase):
|
|||
"accept": "application/json",
|
||||
"content-type": "application/json",
|
||||
}
|
||||
url = get_url()
|
||||
url = get_site_url(frappe.local.site)
|
||||
url += "/api/method/frappe.client.get_list"
|
||||
|
||||
res = requests.post(url, json=params, headers=headers)
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class TestPerformance(FrappeTestCase):
|
|||
frappe.clear_cache()
|
||||
|
||||
def setUp(self) -> None:
|
||||
self.HOST = frappe.utils.get_url()
|
||||
self.HOST = frappe.utils.get_site_url(frappe.local.site)
|
||||
|
||||
self.reset_request_specific_caches()
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ import frappe
|
|||
|
||||
# utility functions like cint, int, flt, etc.
|
||||
from frappe.utils.data import *
|
||||
from frappe.utils.deprecations import deprecated
|
||||
from frappe.utils.html_utils import sanitize_html
|
||||
|
||||
EMAIL_NAME_PATTERN = re.compile(r"[^A-Za-z0-9\u00C0-\u024F\/\_\' ]+")
|
||||
|
|
@ -529,9 +528,11 @@ def get_request_site_address(full_address=False):
|
|||
return get_url(full_address=full_address)
|
||||
|
||||
|
||||
@deprecated
|
||||
def get_site_url(site):
|
||||
return frappe.utils.get_url()
|
||||
conf = frappe.get_conf(site)
|
||||
if conf.host_name:
|
||||
return conf.host_name
|
||||
return f"http://{site}:{conf.webserver_port}"
|
||||
|
||||
|
||||
def encode_dict(d, encoding="utf-8"):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue