From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1RETJi-0003SG-3M for garchives@archives.gentoo.org; Thu, 13 Oct 2011 21:59:54 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id ADC8E21C1E8; Thu, 13 Oct 2011 21:59:41 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 8054521C1E8 for ; Thu, 13 Oct 2011 21:59:41 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 12B831B4018 for ; Thu, 13 Oct 2011 21:59:41 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 60E5D80042 for ; Thu, 13 Oct 2011 21:59:40 +0000 (UTC) From: "Paweł Hajdan" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Paweł Hajdan" Message-ID: Subject: [gentoo-commits] proj/arch-tools:master commit in: / X-VCS-Repository: proj/arch-tools X-VCS-Files: bugzilla-viewer.py X-VCS-Directories: / X-VCS-Committer: phajdan.jr X-VCS-Committer-Name: Paweł Hajdan X-VCS-Revision: cb1eac2e87e24b35de97afff8e6332eacccb57e5 Date: Thu, 13 Oct 2011 21:59:40 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 66aebf6822496d58faf5e7825269dd57 commit: cb1eac2e87e24b35de97afff8e6332eacccb57e5 Author: Pawel Hajdan, Jr gentoo org> AuthorDate: Thu Oct 13 21:58:45 2011 +0000 Commit: Pawe=C5=82 Hajdan gentoo org> CommitDate: Thu Oct 13 21:58:45 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/arch-tools.gi= t;a=3Dcommit;h=3Dcb1eac2e Fix a crash when dependent bug is not accessible. --- bugzilla-viewer.py | 26 +++++++++++++++++++------- 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 =20 class Bug: - def __init__(self, xml): - self.__id =3D int(xml.find("bug_id").text) - self.__summary =3D xml.find("short_desc").text - self.__status =3D xml.find("bug_status").text - self.__depends_on =3D [int(dep.text) for dep in xml.findall("dependson= ")] - self.__comments =3D [c.find("who").text + "\n" + c.find("thetext").tex= t for c in xml.findall("long_desc")] + def __init__(self, xml=3DNone, id_number=3DNone, summary=3DNone, status= =3DNone): + if xml is not None: + self.__id =3D int(xml.find("bug_id").text) + self.__summary =3D xml.find("short_desc").text + self.__status =3D xml.find("bug_status").text + self.__depends_on =3D [int(dep.text) for dep in xml.findall("dependso= n")] + self.__comments =3D [c.find("who").text + "\n" + c.find("thetext").te= xt for c in xml.findall("long_desc")] + if id_number is not None: + self.__id =3D id_number + if summary is not None: + self.__summary =3D summary + if status is not None: + self.__status =3D status self.__cpvs_detected =3D False self.__cpvs =3D [] =09 @@ -118,6 +125,11 @@ class MainWindow: self.add_bug_to_queue() =20 c =3D self.screen.getch() +=09 + def bug_for_id(self, bug_id): + if bug_id in self.bugs_dict: + return self.bugs_dict[bug_id] + return Bug(id_number=3Dbug_id, summary=3D'(summary unavailable)', stat= us=3D'UNKNOWN') =20 def init_screen(self): (self.height, self.width) =3D self.screen.getmaxyx() @@ -188,7 +200,7 @@ class MainWindow: output +=3D textwrap.wrap("Press 'a' to add them to the stabilization= queue.", width=3Dwidth-2) output.append("-" * (width - 2)) =20 - deps =3D [self.bugs_dict[dep_id] for dep_id in bug.depends_on()] + deps =3D [self.bug_for_id(dep_id) for dep_id in bug.depends_on()] if deps: output +=3D textwrap.wrap("Depends on:", width=3Dwidth-2) for dep in deps: