From fcf833e62c1bfa3ce50cfadc4dca03d3da8e60c4 Mon Sep 17 00:00:00 2001 From: Feanil Patel Date: Wed, 23 Jul 2025 10:45:47 -0400 Subject: [PATCH] build: Updates content_staging based on type checking. In the serializer, return an empty string if there is no request object. In content_tagging, just update the type declaration to match the expectation since it can obviously be a None type. --- openedx/core/djangoapps/content_staging/serializers.py | 2 +- openedx/core/djangoapps/content_tagging/rest_api/v1/views.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openedx/core/djangoapps/content_staging/serializers.py b/openedx/core/djangoapps/content_staging/serializers.py index fff9ff316e..753e040972 100644 --- a/openedx/core/djangoapps/content_staging/serializers.py +++ b/openedx/core/djangoapps/content_staging/serializers.py @@ -66,7 +66,7 @@ class UserClipboardSerializer(serializers.Serializer): except ItemNotFoundError: return "" edit_url = xblock_studio_url(block, find_parent=True) - if edit_url: + if edit_url and request: return request.build_absolute_uri(edit_url) return "" diff --git a/openedx/core/djangoapps/content_tagging/rest_api/v1/views.py b/openedx/core/djangoapps/content_tagging/rest_api/v1/views.py index 578b9a2c58..c2da760e93 100644 --- a/openedx/core/djangoapps/content_tagging/rest_api/v1/views.py +++ b/openedx/core/djangoapps/content_tagging/rest_api/v1/views.py @@ -201,7 +201,7 @@ class ObjectTagExportView(APIView): def write(self, value): return value - object_id: str = kwargs.get('context_id', None) + object_id: str | None = kwargs.get('context_id', None) pseudo_buffer = Echo() if not has_view_object_tags_access(self.request.user, object_id):