From badc60f44eb140f51483ea4d2355bc8d69740ab1 Mon Sep 17 00:00:00 2001 From: Eneko Illarramendi Date: Fri, 13 Dec 2019 19:40:12 +0100 Subject: [PATCH] chore: this looks better --- LNbits/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/LNbits/__init__.py b/LNbits/__init__.py index 9de9a185..8a6a92cf 100644 --- a/LNbits/__init__.py +++ b/LNbits/__init__.py @@ -45,13 +45,13 @@ def deletewallet(): with Database() as db: rowss = db.fetchall("SELECT * FROM wallets WHERE hash = ?", (thewal,)) - if len(rowss) > 0: + if rowss: db.execute("UPDATE wallets SET user = ? WHERE hash = ?", (f"del{rowss[0][4]}", rowss[0][0])) db.execute("UPDATE wallets SET adminkey = ? WHERE hash = ?", (f"del{rowss[0][5]}", rowss[0][0])) db.execute("UPDATE wallets SET inkey = ? WHERE hash = ?", (f"del{rowss[0][6]}", rowss[0][0])) rowsss = db.fetchall("SELECT * FROM wallets WHERE user = ?", (rowss[0][4],)) - if len(rowsss) > 0: + if rowsss: return render_template("deletewallet.html", theid=rowsss[0][4], thewal=rowsss[0][0]) return render_template("index.html") @@ -179,10 +179,10 @@ def wallet(): # user has wallets # ---------------- - if len(user_wallets) > 0: + if user_wallets: wallet = db.fetchall("SELECT * FROM wallets WHERE hash = ?", (thewal,)) - if len(wallet) > 0: + if wallet: walb = wallet[0][1].split(",")[-1] return render_template( "wallet.html", @@ -288,7 +288,7 @@ def api_invoices(): with Database() as db: rows = db.fetchall("SELECT * FROM wallets WHERE inkey = ?", (request.headers["Grpc-Metadata-macaroon"],)) - if len(rows) == 0: + if not rows: return jsonify({"ERROR": "NO KEY"}), 200 dataj = {"amt": postedjson["value"], "memo": postedjson["memo"]}