f691: Use StrictUndefined for templates and fix some issues
References to undefined variables in templates were
silently ignored/converted to None/empty strings. This
makes coding lazy stuff easy, but it makes catching typos
harder.
(It would have catched one of the SQL things earlier!)
But on the other hand it might make the current templates
error out everywhere. In fact, early testing has shown two
instances, that errored out. Those are fixed with this
commit too.
If this turns out to make things more complex and useless
than actually solving any problems, it can easily be
dropped again.