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 1QF2TV-0003Z8-MG for garchives@archives.gentoo.org; Wed, 27 Apr 2011 11:00:05 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E76151C0AE; Wed, 27 Apr 2011 10:58:43 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id B4BB11C0AA for ; Wed, 27 Apr 2011 10:58:43 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 4B8501BC01E for ; Wed, 27 Apr 2011 10:58:43 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id A7A878050C for ; Wed, 27 Apr 2011 10:58:42 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: Subject: [gentoo-commits] proj/layman:master commit in: layman/ X-VCS-Repository: proj/layman X-VCS-Files: layman/dbbase.py X-VCS-Directories: layman/ X-VCS-Committer: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: bc8019e52ba29b30b528d31aa46180576e7d9dcb Date: Wed, 27 Apr 2011 10:58:42 +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: 1fb256f438f6e4f6a63b4b82278ab3b5 commit: bc8019e52ba29b30b528d31aa46180576e7d9dcb Author: Brian Dolbec gmail com> AuthorDate: Thu Feb 24 06:38:03 2011 +0000 Commit: Brian Dolbec gmail com> CommitDate: Sun Mar 27 02:39:13 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/layman.git;a=3D= commit;h=3Dbc8019e5 clean out excessive use of try: except pairs --- layman/dbbase.py | 29 +++++++++-------------------- 1 files changed, 9 insertions(+), 20 deletions(-) diff --git a/layman/dbbase.py b/layman/dbbase.py index 53c2946..7b0a26a 100644 --- a/layman/dbbase.py +++ b/layman/dbbase.py @@ -94,10 +94,7 @@ class DbBase: if not os.path.exists(path): continue =20 - try: - self.read_file(path) - except Exception, error: - if not ignore_init_read_errors: raise error + self.read_file(path) =20 =20 def __eq__(self, other): @@ -118,8 +115,10 @@ class DbBase: document =3D open(path, 'r').read() =20 except Exception, error: - raise IOError('Failed to read the overlay list at ("' - + path + '")!\nError was:\n' + str(error)) + if not ignore_init_read_errors: + self.output.error('Failed to read the overlay list at ("= ' + + path + '")') + raise error =20 self.read(document, origin=3Dpath) =20 @@ -153,15 +152,9 @@ class DbBase: =20 for overlay in overlays: self.output.debug('Parsing overlay entry', 8) - try: - ovl =3D Overlay(config=3Dself.config, xml=3Doverlay, + ovl =3D Overlay(config=3Dself.config, xml=3Doverlay, ignore=3Dself.ignore, quiet=3Dself.quiet) - except Exception, error: - raise error - self.output.warn("DbBase(); Error creating overlay insta= nce", 3) - self.output.warn("Original error was: " + str(error), 3) - else: - self.overlays[ovl.name] =3D ovl + self.overlays[ovl.name] =3D ovl return =20 =20 @@ -186,13 +179,9 @@ class DbBase: self.output.info("DbBase: add_from_dict()") for overlay in overlays: self.output.debug('Parsing overlay entry', 8) - try: - ovl =3D Overlay(self.config, ovl_dict=3Doverlay, + ovl =3D Overlay(self.config, ovl_dict=3Doverlay, ignore=3Dself.ignore, quiet=3Dself.quiet) - except Exception, error: - self.output.warn(str(error), 3) - else: - self.overlays[ovl.name] =3D ovl + self.overlays[ovl.name] =3D ovl return =20 =20