Commit 6a54595c by Chris Rossi

i18n

parent 1ace35da
...@@ -6,6 +6,7 @@ import re ...@@ -6,6 +6,7 @@ import re
from capa import inputtypes, responsetypes from capa import inputtypes, responsetypes
from capa.correctmap import CorrectMap from capa.correctmap import CorrectMap
from django.utils.translation import ugettext as _
@inputtypes.registry.register @inputtypes.registry.register
...@@ -38,7 +39,7 @@ class JSMEInput(inputtypes.InputTypeBase): ...@@ -38,7 +39,7 @@ class JSMEInput(inputtypes.InputTypeBase):
dirty = True dirty = True
if not answer: if not answer:
raise ValueError("Must provide an answer.") raise ValueError(_("Must provide an answer."))
if dirty: if dirty:
self.value = json.dumps( self.value = json.dumps(
...@@ -80,8 +81,9 @@ class JSMEResponse(responsetypes.LoncapaResponse): ...@@ -80,8 +81,9 @@ class JSMEResponse(responsetypes.LoncapaResponse):
def get_answers(self): def get_answers(self):
elements = self.xml.xpath("./answer") elements = self.xml.xpath("./answer")
answer = elements[0].text.strip() if elements:
return {self.answer_id: answer} answer = elements[0].text.strip()
return {self.answer_id: answer}
def get_score(self, student_answers): def get_score(self, student_answers):
graded_answer = json.loads( graded_answer = json.loads(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment