From 35a55f16def1c43bd306189e418d5b357546a78c Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Thu, 27 Jun 2024 11:02:14 +0200 Subject: views: add check for failed /center/info get request Check if the request response is null and report it to the user. --- ogcp/views.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ogcp/views.py b/ogcp/views.py index 83a0e4d..c2a6a17 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -2378,8 +2378,11 @@ def action_center_update(): payload = {"id": int(center)} r = server.get('/center/info', payload) + if not r: + return ogserver_down('scopes') if r.status_code != requests.codes.ok: return ogserver_error('scopes') + form.comment.data = r.json()['comment'] form.name.data = r.json()['name'] @@ -2412,8 +2415,11 @@ def action_center_info(): payload = {"id": int(center)} r = server.get('/center/info', payload) + if not r: + return ogserver_down('scopes') if r.status_code != requests.codes.ok: return ogserver_error('scopes') + form.comment.data = r.json()['comment'] form.comment.render_kw = {'readonly': True} form.name.data = r.json()['name'] -- cgit v1.2.3-18-g5258