summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2020-01-19 18:12:30 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2020-03-17 18:06:44 (GMT)
commite91178a2e1b5d7882901fcb10a7afcf3ccfc57f6 (patch)
tree2544a2bbb735195ebe827e4cd97390106909096c
parent8112d57b0adc2eadd92d30f7cc437deab03a174d (diff)
downloadwelco-e91178a2e1b5d7882901fcb10a7afcf3ccfc57f6.zip
welco-e91178a2e1b5d7882901fcb10a7afcf3ccfc57f6.tar.gz
welco-e91178a2e1b5d7882901fcb10a7afcf3ccfc57f6.tar.bz2
python3: use modern except syntax (#39092)
-rw-r--r--welco/sources/phone/views.py6
-rw-r--r--welco/views.py2
2 files changed, 4 insertions, 4 deletions
diff --git a/welco/sources/phone/views.py b/welco/sources/phone/views.py
index ab9dac4..f04341f 100644
--- a/welco/sources/phone/views.py
+++ b/welco/sources/phone/views.py
@@ -96,7 +96,7 @@ def call_event(request):
assert isinstance(payload['callee'], six.string_types), 'callee must be a string'
if 'data' in payload:
assert isinstance(payload['data'], dict), 'data must be a JSON object'
- except (TypeError, ValueError, AssertionError), e:
+ except (TypeError, ValueError, AssertionError) as e:
return HttpResponseBadRequest(json.dumps({'err': 1, 'msg':
force_text(e)}),
content_type='application/json')
@@ -201,7 +201,7 @@ def take_line(request):
payload = json.loads(request.body)
assert isinstance(payload, dict), 'payload is not a JSON object'
assert payload.keys() == ['callee'], 'payload must have only one key: callee'
- except (TypeError, ValueError, AssertionError), e:
+ except (TypeError, ValueError, AssertionError) as e:
return HttpResponseBadRequest(json.dumps({'err': 1, 'msg':
force_text(e)}),
content_type='application/json')
@@ -222,7 +222,7 @@ def release_line(request):
payload = json.loads(request.body)
assert isinstance(payload, dict), 'payload is not a JSON object'
assert payload.keys() == ['callee'], 'payload must have only one key: callee'
- except (TypeError, ValueError, AssertionError), e:
+ except (TypeError, ValueError, AssertionError) as e:
return HttpResponseBadRequest(json.dumps({'err': 1, 'msg':
force_text(e)}),
content_type='application/json')
diff --git a/welco/views.py b/welco/views.py
index 2efa6f3..bcd284f 100644
--- a/welco/views.py
+++ b/welco/views.py
@@ -180,7 +180,7 @@ def create_formdata(request, *args, **kwargs):
qualif = Association.objects.get(id=kwargs.get('pk'))
try:
qualif.push(request)
- except Exception, e:
+ except Exception as e:
json.dump({'err': 1, 'msg': str(e)}, response)
return response
json.dump({'result': 'ok', 'url': qualif.formdata_url}, response)