Newer
Older
if not grade_data["released"]:
return None
if (grade_data["grade_percent"] is not None
or grade_data["feedback_text"]):
if grade_data["grade_percent"] is not None:
correctness = grade_data["grade_percent"]/100
feedback_text = "<p>%s</p>" % get_auto_feedback(correctness)
else:
correctness = None
feedback_text = ""
if grade_data["feedback_text"]:
feedback_text += (
string_concat(
"<p>",
_("The following feedback was provided"),
":<p>")
+ markup_to_html(
page_context, grade_data["feedback_text"],
use_jinja=False))
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
return AnswerFeedback(
correctness=correctness,
feedback=feedback_text)
else:
return None
class PageBaseWithCorrectAnswer(PageBase):
def allowed_attrs(self):
return super(PageBaseWithCorrectAnswer, self).allowed_attrs() + (
("correct_answer", "markup"),
)
def correct_answer(self, page_context, page_data, answer_data, grade_data):
if hasattr(self.page_desc, "correct_answer"):
return markup_to_html(page_context, self.page_desc.correct_answer)
else:
return None
# }}}
def get_editor_interaction_mode(page_context):
if (page_context.flow_session is not None
and page_context.flow_session.participation is not None):
return page_context.flow_session.participation.user.editor_mode
else:
return "default"