Fix crash in stage 3 when ValidationErrors occur

Basically when raising a ValidationError on stage 3 of the dataset
creation, the new_metadata method didn't set context before
_setup_template_variables was called, raising an exception.

Note that this prevents the exception, but the message is still not
shown (see #586).