mitodl/mitxpro

AttributeError: 'NoneType' object has no attribute 'topics'

Closed this issue · 3 comments

Sentry Issue: XPRO-65D

AttributeError: 'NoneType' object has no attribute 'topics'
(28 additional frame(s) were not displayed)
...
  File "rest_framework/serializers.py", line 663, in to_representation
    return [
  File "rest_framework/serializers.py", line 664, in <listcomp>
    self.child.to_representation(item) for item in iterable
  File "rest_framework/serializers.py", line 515, in to_representation
    ret[field.field_name] = field.to_representation(attribute)
  File "rest_framework/fields.py", line 1882, in to_representation
    return method(value)
  File "courses/serializers.py", line 158, in get_topics
    [{"name": topic.name} for topic in instance.page.topics.all()],

It looks like we throw an error when someone tries to checkout with a course that doesn't have a topic set. This shouldn't be a requirement.

#2644 should fix this.

Closed via #2644