summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'bugzilla-viewer.py')
-rwxr-xr-xbugzilla-viewer.py26
1 files changed, 19 insertions, 7 deletions
diff --git a/bugzilla-viewer.py b/bugzilla-viewer.py
index 0891979..c45530a 100755
--- a/bugzilla-viewer.py
+++ b/bugzilla-viewer.py
@@ -29,12 +29,19 @@ class TermTooSmall(Exception):
pass
class Bug:
- def __init__(self, xml):
- self.__id = int(xml.find("bug_id").text)
- self.__summary = xml.find("short_desc").text
- self.__status = xml.find("bug_status").text
- self.__depends_on = [int(dep.text) for dep in xml.findall("dependson")]
- self.__comments = [c.find("who").text + "\n" + c.find("thetext").text for c in xml.findall("long_desc")]
+ def __init__(self, xml=None, id_number=None, summary=None, status=None):
+ if xml is not None:
+ self.__id = int(xml.find("bug_id").text)
+ self.__summary = xml.find("short_desc").text
+ self.__status = xml.find("bug_status").text
+ self.__depends_on = [int(dep.text) for dep in xml.findall("dependson")]
+ self.__comments = [c.find("who").text + "\n" + c.find("thetext").text for c in xml.findall("long_desc")]
+ if id_number is not None:
+ self.__id = id_number
+ if summary is not None:
+ self.__summary = summary
+ if status is not None:
+ self.__status = status
self.__cpvs_detected = False
self.__cpvs = []
@@ -118,6 +125,11 @@ class MainWindow:
self.add_bug_to_queue()
c = self.screen.getch()
+
+ def bug_for_id(self, bug_id):
+ if bug_id in self.bugs_dict:
+ return self.bugs_dict[bug_id]
+ return Bug(id_number=bug_id, summary='(summary unavailable)', status='UNKNOWN')
def init_screen(self):
(self.height, self.width) = self.screen.getmaxyx()
@@ -188,7 +200,7 @@ class MainWindow:
output += textwrap.wrap("Press 'a' to add them to the stabilization queue.", width=width-2)
output.append("-" * (width - 2))
- deps = [self.bugs_dict[dep_id] for dep_id in bug.depends_on()]
+ deps = [self.bug_for_id(dep_id) for dep_id in bug.depends_on()]
if deps:
output += textwrap.wrap("Depends on:", width=width-2)
for dep in deps: