Don't crash on delete requests

This commit is contained in:
Stephan Kulow 2022-10-20 08:57:14 +02:00
parent 988b10e4b7
commit eae411941b

View File

@ -3,9 +3,13 @@ class Request:
self.number = int(xml.get("id")) self.number = int(xml.get("id"))
self.creator = xml.get("creator") self.creator = xml.get("creator")
self.state = xml.find("state").get("name") self.state = xml.find("state").get("name")
self.target = xml.find("action/target").get("project")
self.type_ = xml.find("action").get("type") self.type_ = xml.find("action").get("type")
if self.type_ == "delete": if self.type_ == "delete":
self.source_package = None
self.source_project = None
self.source_rev = None
# not much to do # not much to do
return self return self
@ -15,8 +19,6 @@ class Request:
# expanded MD5 or commit revision # expanded MD5 or commit revision
self.source_rev = xml.find("action/source").get("rev") self.source_rev = xml.find("action/source").get("rev")
self.target = xml.find("action/target").get("project")
# TODO: support muti-action requests # TODO: support muti-action requests
# TODO: parse review history # TODO: parse review history
# TODO: add description # TODO: add description