raise Error when user not found in getBuildNotifications

This commit is contained in:
Yuming Zhu 2018-07-31 17:50:07 +08:00
parent e50cd283b8
commit 5a229a092e
2 changed files with 32 additions and 9 deletions

View file

@ -11004,15 +11004,11 @@ class RootExports(object):
def getBuildNotifications(self, userID=None):
"""Get build notifications for the user with the given ID. If no ID
is specified, get the notifications for the currently logged-in user. If
there is no currently logged-in user, raise a GenericError."""
if userID is None:
user = self.getLoggedInUser()
if user is None:
raise koji.GenericError('not logged-in')
else:
userID = user['id']
"""Get build notifications for the user with the given ID, name or
Kerberos principal. If no user is specified, get the notifications for
the currently logged-in user. If there is no currently logged-in user,
raise a GenericError."""
userID = get_user(userID, strict=True)['id']
return get_build_notifications(userID)
def getBuildNotification(self, id):