From c42e2ef3ac068e597378e0788b4a2e3d1b496ecf Mon Sep 17 00:00:00 2001 From: Inex Code Date: Wed, 26 Jun 2024 14:21:58 +0300 Subject: [PATCH] Revert "feat: move get_subdomain to parent class really" This reverts commit 4eaefc832113563441528f8fc8011d6959926e30. --- selfprivacy_api/services/roundcube/__init__.py | 8 ++++++++ selfprivacy_api/services/service.py | 8 +++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/selfprivacy_api/services/roundcube/__init__.py b/selfprivacy_api/services/roundcube/__init__.py index 9a52c3a..b61282b 100644 --- a/selfprivacy_api/services/roundcube/__init__.py +++ b/selfprivacy_api/services/roundcube/__init__.py @@ -44,6 +44,14 @@ class Roundcube(Service): subdomain = get_subdomain() return f"https://{subdomain}.{domain}" + @staticmethod + def get_subdomain() -> Optional[str]: + with ReadUserData() as data: + if "roundcube" in data["modules"]: + return data["modules"]["roundcube"]["subdomain"] + + return "webmail" + @staticmethod def is_movable() -> bool: return False diff --git a/selfprivacy_api/services/service.py b/selfprivacy_api/services/service.py index 262d690..64a1e80 100644 --- a/selfprivacy_api/services/service.py +++ b/selfprivacy_api/services/service.py @@ -1,5 +1,4 @@ """Abstract class for a service running on a server""" - from abc import ABC, abstractmethod from typing import List, Optional @@ -74,14 +73,13 @@ class Service(ABC): """ pass + @staticmethod + @abstractmethod def get_subdomain() -> Optional[str]: """ The assigned primary subdomain for this service. """ - with ReadUserData() as data: - if self.get_display_name() in data["modules"]: - if "subdomain" in data["modules"][self.get_display_name()]: - return data["modules"][self.get_display_name()]["subdomain"] + pass @classmethod def get_user(cls) -> Optional[str]: