Closed valentin-p closed 3 years ago
This Friday (Jan 29th 2021), we're going to explode this repo back into the individual track repositories and archive this repo.
As such, this PR needs to be merged by Friday 9am UTC, or it will need to be manually reopened against the track repo.
Hey Val, Taking a second quick look this morning, and I have some additional points:
We really should warn people that they cannot use f-strings
when they are wrapping text for translation. They have to use str.format()
. See this SO post for some details. TL;DR: the way the f-string
variables are evaluated short-circuits the process that looks up the string translation, so translating doesn't happen.
Because our error messages for tests show up in the UI, but the test file does not -- we need to make sure that we have friendly error messages. Here is a snip from the basics excercise tests:
which will display in the UI as:
They'll also get the individual test case code, but the message is a little more friendly and helps with debugging.
f-strings
can use any sort of expression inside the curly braces, it is best to keep those simple, and to never, ever use inputs that aren't sanitized. Using an expression inside those {}
is like using eval()
or exec()
...so they aren't "safe", which is why there are still the template strings option and .format()
.Apologies - one last thing: could you please add @J08K as a contributor? I know this was a re-write, but he put considerable work into the original to get started and we should acknowledge that work. Thanks!
Closes #1647