Django

Code

Changeset 717

Show
Ignore:
Timestamp:
09/29/05 08:26:49 (3 years ago)
Author:
jacob
Message:

Fixed #546 - render_to_string and render_to_response may now take lists of templates and use select_template instead of get_template. Thanks, hugo

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/core/template_loader.py

    r715 r717  
    2323    """ 
    2424    Loads the given template_name and renders it with the given dictionary as 
    25     context. Returns a string. 
     25    context. The template_name may be a string to load a single template using 
     26    get_template, or it may be a tuple to use select_template to find one of 
     27    the templates in the list.  Returns a string.  
    2628    """ 
    2729    dictionary = dictionary or {} 
    28     t = get_template(template_name) 
     30    if isinstance(template_name, (list, tuple)): 
     31        t = select_template(template_name) 
     32    else: 
     33        t = get_template(template_name) 
    2934    if context_instance: 
    3035        context_instance.update(dictionary)