From 6fe743c281bfc30ddbf824a2fec3722e96f56a7a Mon Sep 17 00:00:00 2001 From: Mateusz779 Date: Wed, 19 Apr 2023 10:22:38 +0200 Subject: [PATCH] zmiana ip --- db.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/db.py b/db.py index c4e8b9f..64b5d58 100644 --- a/db.py +++ b/db.py @@ -247,9 +247,7 @@ def del_image_allocation(sql, value): def del_image_allocation_id_image(image_id): - delete = del_image_allocation("DELETE FROM image_allocation WHERE image_id = %s", image_id) - print(delete) - return delete + return del_image_allocation("DELETE FROM image_allocation WHERE image_id = %s", image_id) def del_image_allocation_id(id): @@ -268,12 +266,15 @@ def update_image_allocation_time(id): except: return None -def update_image_allocation_ip(id, ip): +def update_image_allocation_ip(token, ip): + image_id = get_conf_id(token) + if image_id is None: + return None connect() with get_cur() as cur: cur.execute(""" - UPDATE image_allocation SET ip = %s WHERE id = %s - """, (ip, id,)) + UPDATE image_allocation SET ip = %s WHERE image_id = %s + """, (ip, image_id,)) try: conn.commit() return True