Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix raw problem view when access directly #1799

Closed
wants to merge 1 commit into from
Closed

Conversation

WallE256
Copy link
Member

No description provided.

@@ -150,7 +150,10 @@ def get_context_data(self, **kwargs):
context['problem_name'] = self.object.name
context['url'] = self.request.build_absolute_uri()
context['description'] = self.object.description
context['math_engine'] = self.request.profile.math_engine
if self.request.profile is not None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused. Why do we need to define a math_engine here in the first place? What's wrong with using MATH_ENGINE in https://github.com/DMOJ/online-judge/blob/master/judge/template_context.py#L122?

cc @int-y1.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fact that we don't use RequestContext when rendering PDFs and the math engine depends on the PDF rendering backend?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess what I meant is why are we using math_engine here instead of changing everything to MATH_ENGINE. In this view, RequestContext is used, so we can get rid of this line (which isn't correct as there's more logic for auto in https://github.com/DMOJ/online-judge/blob/master/judge/template_context.py#L122 than in here). In ProblemPDFView we can rename math_engine to MATH_ENGINE.

@@ -150,7 +150,10 @@ def get_context_data(self, **kwargs):
context['problem_name'] = self.object.name
context['url'] = self.request.build_absolute_uri()
context['description'] = self.object.description
context['math_engine'] = self.request.profile.math_engine
if self.request.profile is not None:
context['math_engine'] = self.request.profile.math_engine
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might still cause error 500 when the user set self.request.profile.math_engine to auto.

@quantum5
Copy link
Member

Can we just delete the raw problem view? Back when it was added, we don't have the management command to dump PDF source files to the disk.

@quantum5
Copy link
Member

Superseded by #1801.

@quantum5 quantum5 closed this Oct 16, 2021
@kiritofeng kiritofeng deleted the fix-raw-problem branch May 31, 2022 13:17
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants