"Fossies" - the Fresh Open Source Software Archive

Member "cheetah3-3.2.6.post2/Cheetah/Django.py" (20 Apr 2021, 590 Bytes) of package /linux/www/cheetah3-3.2.6.post2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "Django.py" see the Fossies "Dox" file reference documentation.

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