Changed internal variable names in django.core.template.loaders.eggs to be consistent with filesystem
git-svn-id: http://code.djangoproject.com/svn/django/trunk@889 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
f808d1bb8c
commit
dc3f6e4113
|
@ -8,18 +8,18 @@ except ImportError:
|
||||||
from django.core.template import TemplateDoesNotExist
|
from django.core.template import TemplateDoesNotExist
|
||||||
from django.conf.settings import INSTALLED_APPS, TEMPLATE_FILE_EXTENSION
|
from django.conf.settings import INSTALLED_APPS, TEMPLATE_FILE_EXTENSION
|
||||||
|
|
||||||
def load_template_source(name, dirs=None):
|
def load_template_source(template_name, template_dirs=None):
|
||||||
"""
|
"""
|
||||||
Loads templates from Python eggs via pkg_resource.resource_string.
|
Loads templates from Python eggs via pkg_resource.resource_string.
|
||||||
|
|
||||||
For every installed app, it tries to get the resource (app, name).
|
For every installed app, it tries to get the resource (app, template_name).
|
||||||
"""
|
"""
|
||||||
if resource_string is not None:
|
if resource_string is not None:
|
||||||
pkg_name = 'templates/' + name + TEMPLATE_FILE_EXTENSION
|
pkg_name = 'templates/' + template_name + TEMPLATE_FILE_EXTENSION
|
||||||
for app in INSTALLED_APPS:
|
for app in INSTALLED_APPS:
|
||||||
try:
|
try:
|
||||||
return resource_string(app, pkg_name)
|
return resource_string(app, pkg_name)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
raise TemplateDoesNotExist, name
|
raise TemplateDoesNotExist, template_name
|
||||||
load_template_source.is_usable = resource_string is not None
|
load_template_source.is_usable = resource_string is not None
|
||||||
|
|
Loading…
Reference in New Issue