fix: remove settings.DEBUG from problem block (#37812)

* fix: remove settings.DEBUG from problem block
This commit is contained in:
Irtaza Akram
2026-01-06 17:51:50 +05:00
committed by GitHub
parent 1d9ca333cf
commit 87bf1003b7
2 changed files with 3 additions and 1 deletions

View File

@@ -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):

View File

@@ -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 = "<div>Test Template HTML</div>"
block = CapaFactory.create()
block.runtime.is_author_mode = True
# Simulate throwing an exception when the capa problem
# is asked to render itself as HTML