mitodl / mitx-grading-library

The MITx Grading Library, a python grading library for edX
https://edge.edx.org/courses/course-v1:MITx+grading-library+examples/
BSD 3-Clause "New" or "Revised" License
14 stars 9 forks source link

EdX Errors with Python Newlines are Problematic #82

Closed ChristopherChudzicki closed 6 years ago

ChristopherChudzicki commented 6 years ago

Of course Python newline (\n) doesn't display correctly if used in edx XML. But if you use one in an error message, you get a traceback, too!

def cfn(e, a):
    raise Exception("A \n B")
]]>
</script>
screen shot 2018-07-13 at 12 51 26 am

whereas with HTML newlines only:

def cfn(e, a):
    raise Exception("A <br/> B")
]]>
</script>
screen shot 2018-07-13 at 12 51 19 am

So ... that's weird.

Not a big problem for us, easily resolved by editing AbstractGrader's __call__ method.

jolyonb commented 6 years ago

I could've sworn that we were doing that already, no?

ChristopherChudzicki commented 6 years ago

I thought so too, but we were only doing it in 'msg' and 'overall_message', NOT errors.

jolyonb commented 6 years ago

Fair enough. I like issues like this that have a one-liner fix!

jolyonb commented 6 years ago

Hmm. Apparently if you put "Resolves #issuenumber" in the PR description, when merged, it closes the issue automatically. But not if you put it in comments. Ah well.