Skip to content

Commit fee13a0

Browse files
committed
only allow valid datasets
1 parent 15d6b9b commit fee13a0

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

shapeout2/gui/dcor/__init__.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,15 @@ def perform_search(self, string, search_type, api_base, api_headers):
153153
c = api_base + "/action/dcserv?id={}&query=valid".format(res["id"])
154154
req = requests.get(c, headers=api_headers)
155155
if req.ok:
156-
name = "{}: {} <{}@{}>".format(
157-
pkg["title"],
158-
res["name"],
159-
pkg["name"],
160-
pkg["organization"]["name"],
161-
)
162-
ru = api_base + "/action/dcserv?id={}".format(res["id"])
163-
res_list.append([ru, name])
156+
if req.json()["result"]: # only use valid data
157+
name = "{}: {} <{}@{}>".format(
158+
pkg["title"],
159+
res["name"],
160+
pkg["name"],
161+
pkg["organization"]["name"],
162+
)
163+
ru = api_base + "/action/dcserv?id={}".format(res["id"])
164+
res_list.append([ru, name])
164165
else:
165166
failed.append("{}: {}".format(res["id"], req.reason))
166167
if failed:

0 commit comments

Comments
 (0)