diff options
author | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-06-27 11:02:14 +0200 |
---|---|---|
committer | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-06-28 08:43:20 +0200 |
commit | 35a55f16def1c43bd306189e418d5b357546a78c (patch) | |
tree | 20690fb40c4bcc2611f70db95323fdabc2a5f373 /ogcp | |
parent | 50dbc817062f21bcd8a483d57def1a4cb13dcb80 (diff) |
views: add check for failed /center/info get request
Check if the request response is null and report it to the user.
Diffstat (limited to 'ogcp')
-rw-r--r-- | ogcp/views.py | 6 |
1 files changed, 6 insertions, 0 deletions
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'] |