Catch invalid category options
If there are invalid options in the category.yaml, the program will not abort and will instead use an empty dictionary.
This commit is contained in:
parent
5f0fe38ba8
commit
5af505f962
@ -28,7 +28,12 @@ Options = namedtuple(
|
|||||||
)
|
)
|
||||||
|
|
||||||
cfg = yaml.safe_load(open("categories.yaml"))
|
cfg = yaml.safe_load(open("categories.yaml"))
|
||||||
categories = {k: Options(**v) if v else Options() for k, v in cfg.items()}
|
try:
|
||||||
|
categories = {k: Options(**v) if v else Options() for k, v in cfg.items()}
|
||||||
|
except TypeError:
|
||||||
|
logging.exception("Invalid option in categories.yaml")
|
||||||
|
categories = {}
|
||||||
|
|
||||||
groups = {
|
groups = {
|
||||||
group: [
|
group: [
|
||||||
category for category, options in categories.items() if options.group == group
|
category for category, options in categories.items() if options.group == group
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user