From c6125f35473cd31360f2a4473ed64f65ce9b9a8e Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 19 Sep 2012 19:58:51 -0400 Subject: [PATCH] storage: don't try to load empty names. This avoids problems with configuration files like: [course] ... assistants: ... where the `assistants` field exists but lists no names. --- pygrader/storage.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pygrader/storage.py b/pygrader/storage.py index b69b798..a5516e9 100644 --- a/pygrader/storage.py +++ b/pygrader/storage.py @@ -64,7 +64,9 @@ def load_course(basedir): names = {'robot': [config.get('course', 'robot').strip()]} for option in ['assignments', 'professors', 'assistants', 'students']: names[option] = [ - a.strip() for a in config.get('course', option).split(',')] + a.strip() for a in config.get('course', option).split(',')] + while '' in names[option]: + names[option].remove('') assignments = [] for assignment in names['assignments']: _LOG.debug('loading assignment {}'.format(assignment)) -- 2.26.2