From 3f6f130113eef6883f2e26a52b5cd6fe83427a03 Mon Sep 17 00:00:00 2001 From: jingrow Date: Tue, 23 Dec 2025 23:00:13 +0800 Subject: [PATCH] update DOCTYPES to PAGETYPES --- press/api/client.py | 4 ++-- .../press/doctype/server/patches/set_plan_and_subscription.py | 4 ++-- press/press/doctype/site/site.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/press/api/client.py b/press/api/client.py index 366d4ca1..aa2506c4 100644 --- a/press/api/client.py +++ b/press/api/client.py @@ -23,7 +23,7 @@ from jcloude.utils import has_role if typing.TYPE_CHECKING: from jingrow.model.meta import Meta -ALLOWED_DOCTYPES = [ +ALLOWED_PAGETYPES = [ "Site", "Site App", "Site Domain", @@ -483,7 +483,7 @@ def is_allowed_table_field(pagetype, field): def check_permissions(pagetype): - if pagetype not in ALLOWED_DOCTYPES: + if pagetype not in ALLOWED_PAGETYPES: raise_not_permitted() if not hasattr(jingrow.local, "team") or not jingrow.local.team(): diff --git a/press/press/doctype/server/patches/set_plan_and_subscription.py b/press/press/doctype/server/patches/set_plan_and_subscription.py index 816da38c..90dd7efe 100644 --- a/press/press/doctype/server/patches/set_plan_and_subscription.py +++ b/press/press/doctype/server/patches/set_plan_and_subscription.py @@ -5,8 +5,8 @@ import jingrow def execute(): - DOCTYPES = ["Server", "Database Server"] - for pagetype in DOCTYPES: + PAGETYPES = ["Server", "Database Server"] + for pagetype in PAGETYPES: server_names = jingrow.get_all( pagetype, {"status": ("!=", "Archived"), "virtual_machine": ("is", "set")}, diff --git a/press/press/doctype/site/site.py b/press/press/doctype/site/site.py index b73f6107..279154a3 100644 --- a/press/press/doctype/site/site.py +++ b/press/press/doctype/site/site.py @@ -115,7 +115,7 @@ if TYPE_CHECKING: from jcloude.jcloude.pagetype.site_domain.site_domain import SiteDomain from jcloude.jcloude.pagetype.tls_certificate.tls_certificate import TLSCertificate -DOCTYPE_SERVER_TYPE_MAP = { +PAGETYPE_SERVER_TYPE_MAP = { "Server": "Application", "Database Server": "Database", "Proxy Server": "Proxy", @@ -934,7 +934,7 @@ class Site(Page, TagHelpers): mountpoint = server.guess_data_disk_mountpoint() free_space = server.free_space(mountpoint) if (diff := free_space - space_required) <= 0: - msg = f"Insufficient estimated space on {DOCTYPE_SERVER_TYPE_MAP[server.pagetype]} server to {purpose}. Required: {human_readable(space_required)}, Available: {human_readable(free_space)} (Need {human_readable(abs(diff))} more)." + msg = f"Insufficient estimated space on {PAGETYPE_SERVER_TYPE_MAP[server.pagetype]} server to {purpose}. Required: {human_readable(space_required)}, Available: {human_readable(free_space)} (Need {human_readable(abs(diff))} more)." if server.public and not no_increase: self.try_increasing_disk(server, mountpoint, diff, msg) else: