-
Notifications
You must be signed in to change notification settings - Fork 391
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
Conversation
@@ -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: |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought math_engine
was needed for https://github.com/DMOJ/online-judge/blob/master/templates/problem/raw.html#L82
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
.
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. |
Superseded by #1801. |
No description provided.