Allow tenant-aware 500 templates

This allows tenant-aware templates to be used by 500 handlers. With tests!

Fixes #1.