From f67eaef90bc3950290eb20152e8b37193e1cd41c Mon Sep 17 00:00:00 2001 From: "theo@manjaro" Date: Tue, 12 Jul 2022 10:45:35 +0200 Subject: [PATCH] Ignore cache if "full" is specified --- src/domain.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/domain.py b/src/domain.py index 0378cca51..b7ab302b8 100644 --- a/src/domain.py +++ b/src/domain.py @@ -61,7 +61,7 @@ def domain_list(exclude_subdomains=False,auto_push=False,full=False): """ global domain_list_cache - if not exclude_subdomains and domain_list_cache: + if not (exclude_subdomains or full) and domain_list_cache: return domain_list_cache from yunohost.utils.ldap import _get_ldap_interface @@ -93,7 +93,6 @@ def domain_list(exclude_subdomains=False,auto_push=False,full=False): result_list = sorted(result_list, key=cmp_domain) - # Don't cache answer if using exclude_subdomains if exclude_subdomains: return {"domains": result_list, "main": _get_maindomain()} @@ -102,8 +101,13 @@ def domain_list(exclude_subdomains=False,auto_push=False,full=False): domain = result_list[i] result_list[i] = {'name':domain,'isdyndns': is_yunohost_dyndns_domain(domain)} - domain_list_cache = {"domains": result_list, "main": _get_maindomain()} - return domain_list_cache + result = {"domains": result_list, "main": _get_maindomain()} + + # Cache answer only if not using exclude_subdomains or full + if not (full or exclude_subdomains): + domain_list_cache = result + + return result def _assert_domain_exists(domain):