From 91e6c316200542d4dc6bc7612a959569e752a0fc Mon Sep 17 00:00:00 2001 From: Dan LaManna Date: Mon, 16 Mar 2026 13:24:39 +0000 Subject: [PATCH] Use context manager for database cursor in zip download listing --- isic/zip_download/api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/isic/zip_download/api.py b/isic/zip_download/api.py index d006165c..6b4dc002 100644 --- a/isic/zip_download/api.py +++ b/isic/zip_download/api.py @@ -125,8 +125,8 @@ def zip_download_listing( request: NinjaAuthHttpRequest, ): # use repeatable read to ensure consistent results - cursor = connection.cursor() - cursor.execute("SET TRANSACTION ISOLATION LEVEL REPEATABLE READ") + with connection.cursor() as cursor: + cursor.execute("SET TRANSACTION ISOLATION LEVEL REPEATABLE READ") token = request.auth["token"] user, search = SearchQueryIn.from_token_representation(request.auth)