From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 3F2FF138D19 for ; Tue, 14 Jul 2015 15:15:03 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C348BE089D; Tue, 14 Jul 2015 15:15:02 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 6CC32E089D for ; Tue, 14 Jul 2015 15:15:02 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 88BA33409DC for ; Tue, 14 Jul 2015 15:15:01 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 16BF7905 for ; Tue, 14 Jul 2015 15:15:00 +0000 (UTC) From: "Devan Franchini" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Devan Franchini" Message-ID: <1436886954.cf8329cb7218173bba6cc57ed8f43e54e8ec9775.twitch153@gentoo> Subject: [gentoo-commits] proj/layman:master commit in: layman/overlays/ X-VCS-Repository: proj/layman X-VCS-Files: layman/overlays/overlay.py X-VCS-Directories: layman/overlays/ X-VCS-Committer: twitch153 X-VCS-Committer-Name: Devan Franchini X-VCS-Revision: cf8329cb7218173bba6cc57ed8f43e54e8ec9775 X-VCS-Branch: master Date: Tue, 14 Jul 2015 15:15:00 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 798c2eb1-2691-4eaa-9a91-59f71304580e X-Archives-Hash: b4638374b8eab525196b98fadc875f11 commit: cf8329cb7218173bba6cc57ed8f43e54e8ec9775 Author: Devan Franchini gentoo org> AuthorDate: Tue Jul 14 15:15:54 2015 +0000 Commit: Devan Franchini gentoo org> CommitDate: Tue Jul 14 15:15:54 2015 +0000 URL: https://gitweb.gentoo.org/proj/layman.git/commit/?id=cf8329cb overlay.py: Adds better error handling for missing "source" entries layman/overlays/overlay.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/layman/overlays/overlay.py b/layman/overlays/overlay.py index 6e289b6..c6a0cee 100755 --- a/layman/overlays/overlay.py +++ b/layman/overlays/overlay.py @@ -160,10 +160,13 @@ class Overlay(object): msg = 'Overlay from_dict(), "name" entry missing from dictionary!' raise Exception(msg) - _sources = overlay['source'] + if 'source' in overlay: + _sources = overlay['source'] + else: + _sources = None if _sources == None: - msg = 'Overlay from_dict(), "%(name)s" is missing a "source"'\ + msg = 'Overlay from_dict(), "%(name)s" is missing a "source" '\ 'entry!' % {'name': self.name} raise Exception(msg) @@ -267,10 +270,13 @@ class Overlay(object): msg = 'Overlay from_json(), "name" entry missing from json!' raise Exception(msg) - _sources = json['source'] + if 'source' in json: + _sources = json['source'] + else: + _sources = None if _sources == None: - msg = 'Overlay from_json(), "%(name)s" is missing a "source"'\ + msg = 'Overlay from_json(), "%(name)s" is missing a "source" '\ 'entry!' % {'name': self.name} raise Exception(msg)