Merge "Clarify KeyError() in Schedule.__init__()"

This commit is contained in:
Jenkins 2016-11-25 02:47:42 +00:00 committed by Gerrit Code Review
commit cee12f20b1
1 changed files with 10 additions and 1 deletions

View File

@ -61,12 +61,21 @@ class Schedule(object):
self.day = sched_yaml['day'].lower().capitalize()
self.irc = sched_yaml['irc']
self.freq = sched_yaml['frequency']
self.recurrence = supported_recurrences[sched_yaml['frequency']]
self._recurrence = sched_yaml['frequency']
except KeyError as e:
print("Invalid YAML meeting schedule definition - missing "
"attribute '{0}'".format(e.args[0]))
raise
# Validate inputs
try:
self.recurrence = supported_recurrences[self._recurrence]
except KeyError as e:
print("Invalid meeting recurrence '{0}' - "
"valid types: {1}".format(e.args[0],
supported_recurrences.keys()))
raise
# optional: start_date defaults to the current date if not present
if 'start_date' in sched_yaml:
try: