class CheckContext(template.Context):
    allowed_vars = ['foo', 'bar', 'baz']

def __getitem__(self, k):
    if k in self.allowed_vars:
        return 'something'
How can I validate the syntax of a django template?