From 2fceb39c27af75414b84eecafea6e827c670ee27 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 30 Oct 2017 14:34:37 +0100 Subject: [PATCH] DjangoClient.capture: simplify check fox exc_info --- opbeat/contrib/django/client.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/opbeat/contrib/django/client.py b/opbeat/contrib/django/client.py index ac921b2d..53bbcc5f 100644 --- a/opbeat/contrib/django/client.py +++ b/opbeat/contrib/django/client.py @@ -164,8 +164,9 @@ def capture(self, event_type, request=None, **kwargs): if is_http_request: data.update(self.get_data_from_request(request)) - if kwargs.get('exc_info'): - exc_value = kwargs['exc_info'][1] + exc_info = kwargs.get('exc_info') + if exc_info: + exc_value = exc_info[1] # As of r16833 (Django) all exceptions may contain a ``django_template_source`` attribute (rather than the # legacy ``TemplateSyntaxError.source`` check) which describes template information. if hasattr(exc_value, 'django_template_source') or ((isinstance(exc_value, TemplateSyntaxError) and