Skip to content

Commit

Permalink
fallback is an argument of Config.getlist (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
dachengx authored Sep 22, 2024
1 parent 16be27e commit cb6e26a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions utilix/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,12 @@ def __init__(self):

self.is_configured = config_file_path is not None

def get_list(self, category, key):
list_string = self.get(category, key)
return [s.strip() for s in list_string.split(",")]
def getlist(self, category, key, fallback=[]):
list_string = self.get(category, key, fallback=",".join(fallback))
if list_string:
return [s.strip() for s in list_string.split(",")]
else:
return []

@property
def logging_level(self):
Expand Down

0 comments on commit cb6e26a

Please sign in to comment.