1 | import Cheetah.Template |
---|
2 | |
---|
3 | def render(template_file, **kwargs): |
---|
4 | ''' |
---|
5 | Cheetah.Django.render() takes the template filename |
---|
6 | (the filename should be a file in your Django |
---|
7 | TEMPLATE_DIRS) |
---|
8 | |
---|
9 | Any additional keyword arguments are passed into the |
---|
10 | template are propogated into the template's searchList |
---|
11 | ''' |
---|
12 | import django.http |
---|
13 | import django.template.loader |
---|
14 | source, loader = django.template.loader.find_template_source(template_file) |
---|
15 | t = Cheetah.Template.Template(source, searchList=[kwargs]) |
---|
16 | return django.http.HttpResponse(t.__str__()) |
---|