Skip to content

Commit

Permalink
Merge pull request #772 from openedx/asheehan-edx/fixing-content-meta…
Browse files Browse the repository at this point in the history
…data-serializer

fix: fixing serializer when missing ent catalog in context
  • Loading branch information
alex-sheehan-edx authored Feb 14, 2024
2 parents 7fe822e + da2e7fc commit 2401451
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions enterprise_catalog/apps/api/v1/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,10 @@ def _add_course_run_enrollment_urls(self, course_instance, serialized_course_run
child course run and adds it to the serialized representation of the
course run record in `serialized_course_runs`.
"""
# Early guard in case the context has no catalog
if not self.context.get('enterprise_catalog'):
return

urls_by_course_run_key = {}
for course_run in ContentMetadata.get_child_records(course_instance):
urls_by_course_run_key[course_run.content_key] = \
Expand Down

0 comments on commit 2401451

Please sign in to comment.