X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/7e70e5f50310b7bdf79e39b4a5a4964f9a6d051b..18800a1a82f29d6d1dda177dcd60715b2c060fb2:/nominatim/config.py?ds=sidebyside diff --git a/nominatim/config.py b/nominatim/config.py index a3f91055..700af328 100644 --- a/nominatim/config.py +++ b/nominatim/config.py @@ -99,6 +99,17 @@ class Configuration: raise UsageError("Configuration error.") from exp + def get_str_list(self, name): + """ Return the given configuration parameter as a list of strings. + The values are assumed to be given as a comma-sparated list and + will be stripped before returning them. On empty values None + is returned. + """ + raw = self.__getattr__(name) + + return [v.strip() for v in raw.split(',')] if raw else None + + def get_path(self, name): """ Return the given configuration parameter as a Path. If a relative path is configured, then the function converts this @@ -144,7 +155,7 @@ class Configuration: style = self.__getattr__('IMPORT_STYLE') if style in ('admin', 'street', 'address', 'full', 'extratags'): - return self.config_dir / 'import-{}.style'.format(style) + return self.config_dir / f'import-{style}.style' return self.find_config_file('', 'IMPORT_STYLE')