PR#1027: [kojihub] add strict parameter in getBuildNotification
Merges #1027 https://pagure.io/koji/pull-request/1027 Fixes: #1009 https://pagure.io/koji/issue/1009 getBuildNotification API call should raise GenericError exception for non existing notification ID
This commit is contained in:
commit
e05f871b4a
1 changed files with 6 additions and 4 deletions
|
|
@ -11011,15 +11011,17 @@ class RootExports(object):
|
|||
userID = get_user(userID, strict=True)['id']
|
||||
return get_build_notifications(userID)
|
||||
|
||||
def getBuildNotification(self, id):
|
||||
"""Get the build notification with the given ID. Return None
|
||||
if there is no notification with the given ID."""
|
||||
def getBuildNotification(self, id, strict=False):
|
||||
"""Get the build notification with the given ID.
|
||||
If there is no notification with the given ID, when strict is True,
|
||||
raise GenericError, else return None.
|
||||
"""
|
||||
fields = ('id', 'user_id', 'package_id', 'tag_id', 'success_only', 'email')
|
||||
query = """SELECT %s
|
||||
FROM build_notifications
|
||||
WHERE id = %%(id)i
|
||||
""" % ', '.join(fields)
|
||||
return _singleRow(query, locals(), fields)
|
||||
return _singleRow(query, locals(), fields, strict=strict)
|
||||
|
||||
def updateNotification(self, id, package_id, tag_id, success_only):
|
||||
"""Update an existing build notification with new data. If the notification
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue