From b4539a49d6327be90850b09a7d8661e535cc78d6 Mon Sep 17 00:00:00 2001 From: Navin Karkera Date: Thu, 16 Jan 2025 12:30:45 +0530 Subject: [PATCH] refactor: check for upstream_version --- openedx/core/djangoapps/content_libraries/tasks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openedx/core/djangoapps/content_libraries/tasks.py b/openedx/core/djangoapps/content_libraries/tasks.py index b67411c1f2a..648960051c0 100644 --- a/openedx/core/djangoapps/content_libraries/tasks.py +++ b/openedx/core/djangoapps/content_libraries/tasks.py @@ -182,8 +182,8 @@ def create_or_update_xblock_upstream_link(usage_key): """ ensure_cms("create_or_update_xblock_upstream_link may only be executed in a CMS context") xblock = modulestore().get_item(UsageKey.from_string(usage_key)) - if not xblock.upstream: - TASK_LOGGER.info(f"No upstream found for xblock: {xblock.usage_key}") + if not xblock.upstream or not xblock.upstream_version: + TASK_LOGGER.info(f"No upstream or upstream_version found for xblock: {xblock.usage_key}") return try: course_name = CourseOverview.get_from_id(xblock.course_id).display_name_with_default