Fetch one result when expecting one result

This commit is contained in:
David Boucha 2012-11-21 14:28:27 -07:00
parent 1a5127d68b
commit 1e3f75aa0c

View File

@ -93,7 +93,7 @@ def get_load(jid):
WHERE `jid` = '%s';''' WHERE `jid` = '%s';'''
cur.execute(sql, (jid,)) cur.execute(sql, (jid,))
data = cur.fetchall() data = cur.fetchone()
if data: if data:
return json.loads(data) return json.loads(data)
return {} return {}
@ -111,7 +111,7 @@ def get_jid(jid):
WHERE `jid` = '%s';''' WHERE `jid` = '%s';'''
cur.execute(sql, (jid,)) cur.execute(sql, (jid,))
data = cur.fetchall() data = cur.fetchone()
ret = {} ret = {}
if data: if data:
for minion, full_ret in data: for minion, full_ret in data: