diff --git a/django/template/loader.py b/django/template/loader.py
index 9ba0f2c..72e9248 100644
a
|
b
|
def find_template_source(name, dirs=None):
|
149 | 149 | raise Exception("Found a compiled template that is incompatible with the deprecated `django.template.loaders.find_template_source` function.") |
150 | 150 | return template, origin |
151 | 151 | |
152 | | def get_template(template_name): |
| 152 | def get_template(template_name, dirs=None): |
153 | 153 | """ |
154 | 154 | Returns a compiled Template object for the given template name, |
155 | 155 | handling template inheritance recursively. |
156 | 156 | """ |
157 | | template, origin = find_template(template_name) |
| 157 | template, origin = find_template(template_name, dirs) |
158 | 158 | if not hasattr(template, 'render'): |
159 | 159 | # template needs to be compiled |
160 | 160 | template = get_template_from_string(template, origin, template_name) |
… |
… |
def get_template_from_string(source, origin=None, name=None):
|
167 | 167 | """ |
168 | 168 | return Template(source, origin, name) |
169 | 169 | |
170 | | def render_to_string(template_name, dictionary=None, context_instance=None): |
| 170 | def render_to_string(template_name, dictionary=None, context_instance=None, dirs=None): |
171 | 171 | """ |
172 | 172 | Loads the given template_name and renders it with the given dictionary as |
173 | 173 | context. The template_name may be a string to load a single template using |
… |
… |
def render_to_string(template_name, dictionary=None, context_instance=None):
|
176 | 176 | """ |
177 | 177 | dictionary = dictionary or {} |
178 | 178 | if isinstance(template_name, (list, tuple)): |
179 | | t = select_template(template_name) |
| 179 | t = select_template(template_name, dirs) |
180 | 180 | else: |
181 | | t = get_template(template_name) |
| 181 | t = get_template(template_name, dirs) |
182 | 182 | if context_instance: |
183 | 183 | context_instance.update(dictionary) |
184 | 184 | else: |
185 | 185 | context_instance = Context(dictionary) |
186 | 186 | return t.render(context_instance) |
187 | 187 | |
188 | | def select_template(template_name_list): |
| 188 | def select_template(template_name_list, dirs=None): |
189 | 189 | "Given a list of template names, returns the first that can be loaded." |
190 | 190 | for template_name in template_name_list: |
191 | 191 | try: |
192 | | return get_template(template_name) |
| 192 | return get_template(template_name, dirs) |
193 | 193 | except TemplateDoesNotExist: |
194 | 194 | continue |
195 | 195 | # If we get here, none of the templates could be loaded |