From 851e098046b16f1fb0a4f1cf02a9997c1ba156a2 Mon Sep 17 00:00:00 2001 From: Adrian Moennich Date: Thu, 12 Oct 2017 10:32:04 +0200 Subject: [PATCH] Piwik: Avoid logging failed requests twice --- piwik/indico_piwik/queries/utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/piwik/indico_piwik/queries/utils.py b/piwik/indico_piwik/queries/utils.py index 0aa8d58..d5a36f6 100644 --- a/piwik/indico_piwik/queries/utils.py +++ b/piwik/indico_piwik/queries/utils.py @@ -25,6 +25,10 @@ def get_json_from_remote_server(func, **kwargs): from Piwik data. """ rawjson = func(**kwargs) + if rawjson is None: + # If the request failed we already logged in in PiwikRequest; + # no need to get into the exception handler below. + return {} try: data = json.loads(rawjson) if isinstance(data, dict) and data.get('result') == 'error':