1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-28 10:46:15 +01: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:
Adrian Schröter 2017-04-18 09:39:59 +02:00
parent a059629e74
commit 7d54b5c685

View File

@ -2697,10 +2697,12 @@ 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')
self.creator = root.get('creator')
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))
self.state = RequestState(root.find('state'))