storage: don't try to load empty names.
authorW. Trevor King <wking@tremily.us>
Wed, 19 Sep 2012 23:58:51 +0000 (19:58 -0400)
committerW. Trevor King <wking@tremily.us>
Thu, 20 Sep 2012 00:15:33 +0000 (20:15 -0400)
This avoids problems with configuration files like:

  [course]
  ...
  assistants:
  ...

where the `assistants` field exists but lists no names.

pygrader/storage.py

index b69b798a66f90f0fa7cafb8ece519a491174c1eb..a5516e9670f8dd007d4194ba33b8b1b23c40f9a1 100644 (file)
@@ -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))