summaryrefslogtreecommitdiffstats
path: root/git-interface
diff options
context:
space:
mode:
Diffstat (limited to 'git-interface')
-rwxr-xr-xgit-interface/git-auth.py5
-rwxr-xr-xgit-interface/git-update.py13
2 files changed, 11 insertions, 7 deletions
diff --git a/git-interface/git-auth.py b/git-interface/git-auth.py
index ebdc75c..45fd577 100755
--- a/git-interface/git-auth.py
+++ b/git-interface/git-auth.py
@@ -40,10 +40,11 @@ cur = conn.execute("SELECT Users.Username, Users.AccountTypeID FROM Users " +
"WHERE SSHPubKeys.PubKey = ? AND Users.Suspended = 0",
(keytype + " " + keytext,))
-if cur.rowcount != 1:
+row = cur.fetchone()
+if not row or cur.fetchone():
exit(1)
-user, account_type = cur.fetchone()
+user, account_type = row
if not re.match(username_regex, user):
exit(1)
diff --git a/git-interface/git-update.py b/git-interface/git-update.py
index 9a127a9..d6c9f10 100755
--- a/git-interface/git-update.py
+++ b/git-interface/git-update.py
@@ -140,8 +140,9 @@ def save_metadata(metadata, conn, user):
for license in pkginfo['license']:
cur = conn.execute("SELECT ID FROM Licenses WHERE Name = ?",
[license])
- if cur.rowcount == 1:
- licenseid = cur.fetchone()[0]
+ row = cur.fetchone()
+ if row:
+ licenseid = row[0]
else:
cur = conn.execute("INSERT INTO Licenses (Name) " +
"VALUES (?)", [license])
@@ -156,8 +157,9 @@ def save_metadata(metadata, conn, user):
for group in pkginfo['groups']:
cur = conn.execute("SELECT ID FROM Groups WHERE Name = ?",
[group])
- if cur.rowcount == 1:
- groupid = cur.fetchone()[0]
+ row = cur.fetchone()
+ if row:
+ groupid = row[0]
else:
cur = conn.execute("INSERT INTO Groups (Name) VALUES (?)",
[group])
@@ -329,7 +331,8 @@ if metadata_pkgbase != pkgbase:
# Ensure that packages are neither blacklisted nor overwritten.
pkgbase = metadata['pkgbase']
cur = conn.execute("SELECT ID FROM PackageBases WHERE Name = ?", [pkgbase])
-pkgbase_id = cur.fetchone()[0] if cur.rowcount == 1 else 0
+row = cur.fetchone()
+pkgbase_id = row[0] if row else 0
cur = conn.execute("SELECT Name FROM PackageBlacklist")
blacklist = [row[0] for row in cur.fetchall()]