From d93ebfcef38a5b29b23da5216bdf0ed9761e3ef8 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: May 15 2020 18:21:48 +0000 Subject: `get_current_event`: return None if there is no current event This is rare, but possible (when we add support for a new compose type, like we are at present: until we create one, there is no 'current' IoT event). Signed-off-by: Adam Williamson --- diff --git a/src/wikitcms/wiki.py b/src/wikitcms/wiki.py index 9632a9a..4d273cc 100644 --- a/src/wikitcms/wiki.py +++ b/src/wikitcms/wiki.py @@ -241,8 +241,15 @@ class Wiki(mwclient.Site): return currdict def get_current_event(self, dist="Fedora"): + """Returns the current event for the given dist as a + ValidationEvent instance. May return None if there is no + current event for the given dist (e.g. none has yet been + created for that dist). + """ wikitcms.helpers.validate_dist(dist) curr = self.get_current_compose(dist=dist) + if not curr: + return None # Use of 'max' plus get_validation_event handles getting us # the right kind of event. return self.get_validation_event(