mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-10 22:56:15 +01:00
core.ReviewState: Add __repr__() method
This commit is contained in:
parent
e132d093e7
commit
815009f647
17
osc/core.py
17
osc/core.py
@ -2749,6 +2749,23 @@ class ReviewState(AbstractState):
|
||||
review_node.find('comment').text:
|
||||
self.comment = review_node.find('comment').text.strip()
|
||||
|
||||
def __repr__(self):
|
||||
result = super().__repr__()
|
||||
result += "("
|
||||
result += f"{self.state}"
|
||||
|
||||
if self.who:
|
||||
result += f" by {self.who}"
|
||||
|
||||
for by in ("user", "group", "project", "package"):
|
||||
by_value = getattr(self, f"by_{by}", None)
|
||||
if by_value:
|
||||
result += f" [{by} {by_value}])"
|
||||
break
|
||||
|
||||
result += ")"
|
||||
return result
|
||||
|
||||
def get_node_attrs(self):
|
||||
return ('state', 'by_user', 'by_group', 'by_project', 'by_package', 'who', 'when')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user