summaryrefslogtreecommitdiff
path: root/django/template/loader.py
diff options
context:
space:
mode:
authorAhmed Mohamed <mohamed@kuicr.kyoto-u.ac.jp>2016-01-21 17:40:33 +0900
committerTim Graham <timograham@gmail.com>2016-01-25 18:37:02 -0500
commit229488c8a1486f25b1f2b5ca422cac67708c6c9d (patch)
tree355afdb8822454c9ccde1f3bdc4def448d193d1a /django/template/loader.py
parent275d11fbc5e8f664552a458ce141d4394fa70e1f (diff)
Fixed #26109 -- Raised a helpful error if loader.select_tamplate() is passed a string.
Diffstat (limited to 'django/template/loader.py')
-rw-r--r--django/template/loader.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/django/template/loader.py b/django/template/loader.py
index 98e56817bf..44d5332b92 100644
--- a/django/template/loader.py
+++ b/django/template/loader.py
@@ -33,6 +33,13 @@ def select_template(template_name_list, using=None):
Raises TemplateDoesNotExist if no such template exists.
"""
+ if isinstance(template_name_list, six.string_types):
+ raise TypeError(
+ 'select_template() takes an iterable of template names but got a '
+ 'string: %r. Use get_template() if you want to load a single '
+ 'template by name.' % template_name_list
+ )
+
chain = []
engines = _engine_list(using)
for template_name in template_name_list: