Lock global request data during template rendering, closes #628