1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-08-11 17:54:06 +02:00

Fixing request handling for OBS < 2.8

request creator is only delivered by OBS 2.8 and newer. Makeing this not a hard
condition therefor. (introduced in d68507fa95)

Also fixes test suite failure
This commit is contained in:
2017-04-18 09:39:59 +02:00
parent a059629e74
commit 7d54b5c685

View File

@@ -2697,9 +2697,11 @@ class Request:
def read(self, root):
"""read in a request"""
self._init_attributes()
if not root.get('id') or not root.get('creator'):
if not root.get('id'):
raise oscerr.APIError('invalid request: %s\n' % ET.tostring(root, encoding=ET_ENCODING))
self.reqid = root.get('id')
if root.get('creator'):
# OBS 2.8 and later is delivering creator informations
self.creator = root.get('creator')
if root.find('state') is None:
raise oscerr.APIError('invalid request (state expected): %s\n' % ET.tostring(root, encoding=ET_ENCODING))