mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-24 13:56:13 +01:00
- fix description rendering in history elements
This commit is contained in:
parent
ea092a7f23
commit
3d07bd8460
3
NEWS
3
NEWS
@ -1,3 +1,6 @@
|
||||
0.149
|
||||
-
|
||||
|
||||
0.148
|
||||
- support new history including review history of OBS 2.6
|
||||
- display request priorities, if important or critical
|
||||
|
19
osc/core.py
19
osc/core.py
@ -5,7 +5,7 @@
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
__version__ = '0.148'
|
||||
__version__ = '0.148git'
|
||||
|
||||
# __store_version__ is to be incremented when the format of the working copy
|
||||
# "store" changes in an incompatible way. Please add any needed migration
|
||||
@ -2357,6 +2357,10 @@ class AbstractState:
|
||||
"""return data from <comment /> tag"""
|
||||
raise NotImplementedError()
|
||||
|
||||
def get_description(self):
|
||||
"""return data from <description /> tag"""
|
||||
raise NotImplementedError()
|
||||
|
||||
def to_xml(self):
|
||||
"""serialize object to XML"""
|
||||
root = ET.Element(self.get_node_name())
|
||||
@ -2364,6 +2368,8 @@ class AbstractState:
|
||||
val = getattr(self, attr)
|
||||
if not val is None:
|
||||
root.set(attr, val)
|
||||
if self.get_description():
|
||||
ET.SubElement(root, 'description').text = self.get_description()
|
||||
if self.get_comment():
|
||||
ET.SubElement(root, 'comment').text = self.get_comment()
|
||||
return root
|
||||
@ -2400,6 +2406,9 @@ class ReviewState(AbstractState):
|
||||
def get_comment(self):
|
||||
return self.comment
|
||||
|
||||
def get_description(self):
|
||||
return None
|
||||
|
||||
|
||||
class RequestHistory(AbstractState):
|
||||
"""Represents a history element of a request"""
|
||||
@ -2420,7 +2429,10 @@ class RequestHistory(AbstractState):
|
||||
self.comment = history_node.find('comment').text.strip()
|
||||
|
||||
def get_node_attrs(self):
|
||||
return ('who', 'when', 'description')
|
||||
return ('who', 'when')
|
||||
|
||||
def get_description(self):
|
||||
return self.description
|
||||
|
||||
def get_comment(self):
|
||||
return self.comment
|
||||
@ -2450,6 +2462,9 @@ class RequestState(AbstractState):
|
||||
def get_comment(self):
|
||||
return self.comment
|
||||
|
||||
def get_description(self):
|
||||
return None
|
||||
|
||||
|
||||
class Action:
|
||||
"""
|
||||
|
@ -7,7 +7,8 @@
|
||||
<target project="deleteme" />
|
||||
</action>
|
||||
<state name="accepted" when="2010-12-27T01:36:29" who="user1" />
|
||||
<history name="new" when="2010-12-13T13:02:03" who="creator">
|
||||
<history when="2010-12-13T13:02:03" who="creator">
|
||||
<description>Create Request</description>
|
||||
<comment>foobar</comment>
|
||||
</history>
|
||||
<title>title of the request</title>
|
||||
|
@ -15,5 +15,7 @@
|
||||
<review by_group="group1" state="new" when="2010-12-28T00:11:22" who="abc">
|
||||
<comment>review start</comment>
|
||||
</review>
|
||||
<history name="new" when="2010-12-11T00:00:00" who="creator" />
|
||||
<history when="2010-12-11T00:00:00" who="creator">
|
||||
<description>Created request</description>
|
||||
</history>
|
||||
</request>
|
||||
|
@ -4,8 +4,12 @@
|
||||
<person name="buguser" />
|
||||
</action>
|
||||
<state name="accepted" when="2010-12-29T16:37:45" who="foobar" />
|
||||
<history name="new" when="2010-12-28T16:37:45" who="user" />
|
||||
<history name="review" when="2010-12-28T18:37:45" who="foobar" />
|
||||
<history when="2010-12-28T16:37:45" who="user" >
|
||||
<description>Created Request</description>
|
||||
</history>
|
||||
<history when="2010-12-28T18:37:45" who="foobar" >
|
||||
<description>Review Approved</description>
|
||||
</history>
|
||||
<description>This is
|
||||
a simple request with a lot of ... ... text and other stuff. This request also contains a
|
||||
description. This is useful to
|
||||
|
@ -342,7 +342,6 @@ class TestRequest(OscTestCase):
|
||||
self.assertEqual(r.state.when, '2010-12-27T01:36:29')
|
||||
self.assertEqual(r.state.who, 'user1')
|
||||
self.assertEqual(r.state.comment, '')
|
||||
self.assertEqual(r.statehistory[0].name, 'new')
|
||||
self.assertEqual(r.statehistory[0].when, '2010-12-13T13:02:03')
|
||||
self.assertEqual(r.statehistory[0].who, 'creator')
|
||||
self.assertEqual(r.statehistory[0].comment, 'foobar')
|
||||
@ -382,7 +381,6 @@ class TestRequest(OscTestCase):
|
||||
self.assertEqual(r.reviews[0].who, 'abc')
|
||||
self.assertEqual(r.reviews[0].comment, 'review start')
|
||||
self.assertTrue(r.reviews[0].by_user is None)
|
||||
self.assertEqual(r.statehistory[0].name, 'new')
|
||||
self.assertEqual(r.statehistory[0].when, '2010-12-11T00:00:00')
|
||||
self.assertEqual(r.statehistory[0].who, 'creator')
|
||||
self.assertEqual(r.statehistory[0].comment, '')
|
||||
@ -455,7 +453,7 @@ class TestRequest(OscTestCase):
|
||||
exp = """\
|
||||
21 State:accepted By:foobar When:2010-12-29T16:37:45
|
||||
set_bugowner: buguser foo
|
||||
From: new(user) -> review(foobar)
|
||||
From: Created Request: user -> Review Approved: foobar
|
||||
Descr: This is a simple request with a lot of ... ... text and other
|
||||
stuff. This request also contains a description. This is useful
|
||||
to describe the request. blabla blabla\n"""
|
||||
@ -488,8 +486,8 @@ Comment: currently in review
|
||||
Review: accepted Group: group1 2010-12-29T00:11:22 abc accepted
|
||||
new Group: group1 2010-12-28T00:11:22 abc review start
|
||||
|
||||
History: revoked 2010-12-12T00:00:00 creator
|
||||
new 2010-12-11T00:00:00 creator"""
|
||||
History: 2010-12-12T00:00:00 creator revoked
|
||||
2010-12-11T00:00:00 creator new"""
|
||||
self.assertEqual(exp, str(r))
|
||||
|
||||
def test_request_str2(self):
|
||||
|
Loading…
Reference in New Issue
Block a user