apluslms/mooc-grader

Incorrect variables in the exercise_template view

markkuriekkinen opened this issue · 4 comments

mooc-grader exercise_template view: wrong variable parameter, inner function has different variables:

if name == parameter:

Actually, parameter is used in the inner function, but it is defined in the outer function. Does Python support closures like that? I think I created this issue because the code crashed in my testing. It is important to also test non-existent files, i.e., when you try to download a template file that does not exist. Either it does not exist on the file system or it is not defined in the exercise config.yaml.

If the file does not exist the following message is shown
image

On the other hand, https://realpython.com/inner-functions-what-are-they-good-for/#closures-and-factory-functions

I was testing and this is what I got

image

image

@jaguarfi thanks, just to confirm, are you saying that you didn't find any problems in the code? That is fine. I may have messed up something myself in my testing. Let's leave the issue open so that I can take a look someday, but now this is not urgent anymore. Thanks for your effort!