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 619641386F3 for ; Thu, 13 Aug 2015 07:07:10 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C7FE8141DF; Thu, 13 Aug 2015 07:07:08 +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 5EB9B141DF for ; Thu, 13 Aug 2015 07:07:08 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 50854340813 for ; Thu, 13 Aug 2015 07:07:07 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 6800C13F for ; Thu, 13 Aug 2015 07:07:04 +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: <1439449484.3e582a86a5389c5013fd0b8c5a6cc964d3252a2c.twitch153@gentoo> Subject: [gentoo-commits] proj/layman:master commit in: layman/db_modules/sqlite_db/ X-VCS-Repository: proj/layman X-VCS-Files: layman/db_modules/sqlite_db/sqlite_db.py X-VCS-Directories: layman/db_modules/sqlite_db/ X-VCS-Committer: twitch153 X-VCS-Committer-Name: Devan Franchini X-VCS-Revision: 3e582a86a5389c5013fd0b8c5a6cc964d3252a2c X-VCS-Branch: master Date: Thu, 13 Aug 2015 07:07:04 +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: 01f82c05-e3ce-44e6-a382-b9d4aa66142d X-Archives-Hash: d7cd83c2f6108792466d0a8a62d982b6 commit: 3e582a86a5389c5013fd0b8c5a6cc964d3252a2c Author: Devan Franchini gentoo org> AuthorDate: Thu Aug 13 07:04:40 2015 +0000 Commit: Devan Franchini gentoo org> CommitDate: Thu Aug 13 07:04:44 2015 +0000 URL: https://gitweb.gentoo.org/proj/layman.git/commit/?id=3e582a86 sqlite_db.py: Modifies owner information gathering method Due to the fact that including the owner name isn't necessary layman needed to modify the way it gathered owner information to prevent run-time errors. layman/db_modules/sqlite_db/sqlite_db.py | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/layman/db_modules/sqlite_db/sqlite_db.py b/layman/db_modules/sqlite_db/sqlite_db.py index 14bfa25..6619699 100644 --- a/layman/db_modules/sqlite_db/sqlite_db.py +++ b/layman/db_modules/sqlite_db/sqlite_db.py @@ -169,15 +169,15 @@ class DBHandler(object): WHERE Overlay_ID = ?''', (overlay_id,)) overlay['source'] = cursor.fetchall() - cursor.execute('''SELECT Owner_Name, Owner_Email FROM + cursor.execute('''SELECT Owner_Email, Owner_Name FROM Overlay_Owner JOIN Overlay USING (Overlay_ID) JOIN Owner USING (Owner_ID) WHERE Overlay_ID = ?''', (overlay_id,)) - owner_info = cursor.fetchall() + owner_info = cursor.fetchall()[0] - if len(owner_info): - owner_info = owner_info[0] - overlay['owner_name'] = owner_info[0] - overlay['owner_email'] = owner_info[1] + overlay['owner_email'] = owner_info[0] + + if len(owner_info) > 1: + overlay['owner_name'] = owner_info[1] cursor.execute('''SELECT Description FROM Description JOIN Overlay USING (Overlay_ID) WHERE Overlay_ID = ?''', @@ -187,12 +187,7 @@ class DBHandler(object): overlay['status'] = overlay_info[3] overlay['quality'] = overlay_info[4] overlay['priority'] = overlay_info[2] - - if overlay_info[7]: - overlay['license'] = overlay_info[7] - else: - overlay['license'] = None - + overlay['license'] = overlay_info[7] overlay['homepage'] = overlay_info[5] overlay['IRC'] = overlay_info[6] @@ -248,8 +243,8 @@ class DBHandler(object): VALUES ( ?, ? )''', (overlay.owner_name, overlay.owner_email,)) connection.commit() - cursor.execute('''SELECT Owner_ID from Owner WHERE Owner_Name = ?;''', - (overlay.owner_name,)) + cursor.execute('''SELECT Owner_ID from Owner WHERE Owner_Email = ?;''', + (overlay.owner_email,)) owner_id = cursor.fetchone()[0] for source in overlay.sources: