From b91ab67e6f81beb3b558209f1f7813420539b6d3 Mon Sep 17 00:00:00 2001 From: David Manthey Date: Mon, 22 Apr 2024 10:49:40 -0400 Subject: [PATCH] Harden API call to database. Update python metadata about versions --- setup.py | 3 +-- wsi_deid/matching_api.py | 1 + wsi_deid/web_client/views/ItemView.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 377ed66..72b19d4 100644 --- a/setup.py +++ b/setup.py @@ -34,12 +34,11 @@ def prerelease_local_scheme(version): 'License :: OSI Approved :: Apache Software License', 'Natural Language :: English', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', ], description='Digital Slide Archive Whole-Slide Image DeIdentification plugin', install_requires=[ diff --git a/wsi_deid/matching_api.py b/wsi_deid/matching_api.py index c52e932..d3c1d82 100644 --- a/wsi_deid/matching_api.py +++ b/wsi_deid/matching_api.py @@ -154,6 +154,7 @@ def lookupQuery(self, query): req = requests.post(self.url, headers=headers, data=json.dumps(query)) except Exception: self.logger.exception('Failed to query API') + return [] return req.json() def lookupQueries(self, queryList): diff --git a/wsi_deid/web_client/views/ItemView.js b/wsi_deid/web_client/views/ItemView.js index 6e97ace..c700fe8 100644 --- a/wsi_deid/web_client/views/ItemView.js +++ b/wsi_deid/web_client/views/ItemView.js @@ -759,7 +759,7 @@ wrap(ItemViewWidget, 'render', function (render) { } // sort the results const sorted = {}; - Object.keys(internal[parts[1]]).sort().forEach((k) => { + Object.keys(internal[parts[1]] || {}).sort().forEach((k) => { sorted[k] = internal[parts[1]][k]; }); internal[parts[1]] = sorted;