From 87bf1003b7e0d3cb3bb6fc36a648102786ae3697 Mon Sep 17 00:00:00 2001 From: Irtaza Akram <51848298+irtazaakram@users.noreply.github.com> Date: Tue, 6 Jan 2026 17:51:50 +0500 Subject: [PATCH] fix: remove settings.DEBUG from problem block (#37812) * fix: remove settings.DEBUG from problem block --- xmodule/capa_block.py | 2 +- xmodule/tests/test_capa_block.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/xmodule/capa_block.py b/xmodule/capa_block.py index 08790e9ffe..d441683e19 100644 --- a/xmodule/capa_block.py +++ b/xmodule/capa_block.py @@ -535,7 +535,7 @@ class _BuiltInProblemBlock( the error in Studio. At the same time, in production, we don't want to show errors to students. """ - return getattr(self.runtime, "is_author_mode", False) or settings.DEBUG + return getattr(self.runtime, "is_author_mode", False) @classmethod def filter_templates(cls, template, course): diff --git a/xmodule/tests/test_capa_block.py b/xmodule/tests/test_capa_block.py index 4beb2389f7..d46f214b02 100644 --- a/xmodule/tests/test_capa_block.py +++ b/xmodule/tests/test_capa_block.py @@ -1408,6 +1408,7 @@ class ProblemBlockTest(unittest.TestCase): # lint-amnesty, pylint: disable=miss """ # Create the block block = CapaFactory.create(attempts=1, user_is_staff=False) + block.runtime.is_author_mode = True # Simulate answering a problem that raises the exception with patch("xmodule.capa.capa_problem.LoncapaProblem.grade_answers") as mock_grade: @@ -2516,6 +2517,7 @@ class ProblemBlockTest(unittest.TestCase): # lint-amnesty, pylint: disable=miss """ render_template.return_value = "
Test Template HTML
" block = CapaFactory.create() + block.runtime.is_author_mode = True # Simulate throwing an exception when the capa problem # is asked to render itself as HTML