models: Fix return type of get_realm_domains.

The correct return type of get_realm_domains should
be List[Dict[str, Union[bool, str]]] instead of
List[Dict[str, str]] because allowed_subdomains is
a bool field not str.
This commit is contained in:
Sahil Batra
2022-03-10 22:36:05 +05:30
committed by Tim Abbott
parent a80e470c9e
commit ee11a68f7a
2 changed files with 2 additions and 1 deletions

View File

@@ -30,6 +30,7 @@ class Command(ZulipBaseCommand):
if options["op"] == "show":
print(f"Domains for {realm.string_id}:")
for realm_domain in get_realm_domains(realm):
assert isinstance(realm_domain["domain"], str)
if realm_domain["allow_subdomains"]:
print(realm_domain["domain"] + " (subdomains allowed)")
else:

View File

@@ -1049,7 +1049,7 @@ class EmailContainsPlusError(Exception):
pass
def get_realm_domains(realm: Realm) -> List[Dict[str, str]]:
def get_realm_domains(realm: Realm) -> List[Dict[str, Union[str, bool]]]:
return list(realm.realmdomain_set.values("domain", "allow_subdomains"))