No aliases in workday (#103091)

This commit is contained in:
G Johansson 2023-10-31 11:35:09 +01:00 committed by GitHub
parent 55a4769172
commit 193ce08b39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View File

@ -54,7 +54,7 @@ def add_province_to_schema(
if not country: if not country:
return schema return schema
all_countries = list_supported_countries() all_countries = list_supported_countries(include_aliases=False)
if not all_countries.get(country): if not all_countries.get(country):
return schema return schema
@ -117,7 +117,7 @@ DATA_SCHEMA_SETUP = vol.Schema(
vol.Required(CONF_NAME, default=DEFAULT_NAME): TextSelector(), vol.Required(CONF_NAME, default=DEFAULT_NAME): TextSelector(),
vol.Optional(CONF_COUNTRY): CountrySelector( vol.Optional(CONF_COUNTRY): CountrySelector(
CountrySelectorConfig( CountrySelectorConfig(
countries=list(list_supported_countries()), countries=list(list_supported_countries(include_aliases=False)),
) )
), ),
} }

View File

@ -43,7 +43,7 @@ class CountryFixFlow(RepairsFlow):
) -> data_entry_flow.FlowResult: ) -> data_entry_flow.FlowResult:
"""Handle the country step of a fix flow.""" """Handle the country step of a fix flow."""
if user_input is not None: if user_input is not None:
all_countries = list_supported_countries() all_countries = list_supported_countries(include_aliases=False)
if not all_countries[user_input[CONF_COUNTRY]]: if not all_countries[user_input[CONF_COUNTRY]]:
options = dict(self.entry.options) options = dict(self.entry.options)
new_options = {**options, **user_input, CONF_PROVINCE: None} new_options = {**options, **user_input, CONF_PROVINCE: None}
@ -61,7 +61,9 @@ class CountryFixFlow(RepairsFlow):
{ {
vol.Required(CONF_COUNTRY): SelectSelector( vol.Required(CONF_COUNTRY): SelectSelector(
SelectSelectorConfig( SelectSelectorConfig(
options=sorted(list_supported_countries()), options=sorted(
list_supported_countries(include_aliases=False)
),
mode=SelectSelectorMode.DROPDOWN, mode=SelectSelectorMode.DROPDOWN,
) )
) )
@ -83,7 +85,9 @@ class CountryFixFlow(RepairsFlow):
return self.async_create_entry(data={}) return self.async_create_entry(data={})
assert self.country assert self.country
country_provinces = list_supported_countries()[self.country] country_provinces = list_supported_countries(include_aliases=False)[
self.country
]
return self.async_show_form( return self.async_show_form(
step_id="province", step_id="province",
data_schema=vol.Schema( data_schema=vol.Schema(