From 98232f14300a9646fdd7cb1d14bd720ff6c67d50 Mon Sep 17 00:00:00 2001 From: Kyle McCormick Date: Thu, 17 Sep 2020 09:17:35 -0400 Subject: [PATCH] Tracking logs: Treat null context same as missing context Should resolve the AttributeError on the line library_name = segment_context.get('library', ... that occurs when full_segment_event['context'] == None. This error is currently the #1 in LMS and is obscuring other errors. --- common/djangoapps/track/views/segmentio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/djangoapps/track/views/segmentio.py b/common/djangoapps/track/views/segmentio.py index efdf8da96856..c376dd69ad5a 100644 --- a/common/djangoapps/track/views/segmentio.py +++ b/common/djangoapps/track/views/segmentio.py @@ -127,7 +127,7 @@ def track_segmentio_event(request): # pylint: disable=too-many-statements # Start with the context provided by Segment in the "client" field if it exists # We should tightly control which fields actually get included in the event emitted. - segment_context = full_segment_event.get('context', {}) + segment_context = full_segment_event.get('context') or {} # Build up the event context by parsing fields out of the event received from Segment context = {}