Fix failure to use fallback for getlist

aqt.helper.MyConfigParser.getlist fails to retrieve a fallback list when
the `section` parameter does not exist in the `settings.ini` file.
This ensures that the fallback is used when that key is missing.
This commit is contained in:
David Dalcino
2022-03-06 17:45:41 -08:00
parent 5a7adb60cf
commit 12d20a3d06

View File

@@ -283,7 +283,9 @@ def xml_to_modules(
class MyConfigParser(configparser.ConfigParser): class MyConfigParser(configparser.ConfigParser):
def getlist(self, section: str, option: str, fallback=[]) -> List[str]: def getlist(self, section: str, option: str, fallback=[]) -> List[str]:
value = self.get(section, option) value = self.get(section, option, fallback=None)
if value is None:
return fallback
try: try:
result = list(filter(None, (x.strip() for x in value.splitlines()))) result = list(filter(None, (x.strip() for x in value.splitlines())))
except Exception: except Exception: