From b08a5854249f9128d3f6a53e1d33020d7b385534 Mon Sep 17 00:00:00 2001 From: Ace Date: Wed, 9 Feb 2022 22:16:26 +0100 Subject: [PATCH] Fix for deleted groups causing Exceptions Deleted groups would previously cause the module to fail as the api would still show todos from groups that have been deleted, but not the name of the group. Iterating over the groups caused a KeyError Exception. This commit does an additional check to see if the group really does exist or has been deleted. --- inkycal/modules/inkycal_todoist.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/inkycal/modules/inkycal_todoist.py b/inkycal/modules/inkycal_todoist.py index b0dc26e..27d4fe7 100644 --- a/inkycal/modules/inkycal_todoist.py +++ b/inkycal/modules/inkycal_todoist.py @@ -136,11 +136,14 @@ class Todoist(inkycal_module): 'name':task['content'], 'due':task['due']['string'] if task['due'] != None else "", 'priority':task['priority'], - 'project':all_projects[ task['project_id'] ] + 'project':all_projects[ task['project_id' ] ] if task['project_id'] in all_projects else "deleted" } for task in tasks] - # logger.debug(f'simplified: {simplified}') + # remove groups that have been deleted + simplified = [task for task in simplified if task['project'] != "deleted"] + + logger.debug(f'simplified: {simplified}') # Get maximum width of project names for selected font project_width = int(max([