mirror of
https://github.com/django/django.git
synced 2024-12-26 19:16:11 +00:00
Made a small improvement to django.views.core.flatfiles so that it only uses select_template if a custom template is available, so as not to hit the filesystem.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@677 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
a39e6c91b1
commit
3dcdce4d63
@ -4,6 +4,8 @@ from django.models.core import flatfiles
|
|||||||
from django.utils.httpwrappers import HttpResponse
|
from django.utils.httpwrappers import HttpResponse
|
||||||
from django.conf.settings import SITE_ID
|
from django.conf.settings import SITE_ID
|
||||||
|
|
||||||
|
DEFAULT_TEMPLATE = 'flatfiles/default'
|
||||||
|
|
||||||
def flat_file(request, url):
|
def flat_file(request, url):
|
||||||
"""
|
"""
|
||||||
Flat file view
|
Flat file view
|
||||||
@ -23,7 +25,10 @@ def flat_file(request, url):
|
|||||||
if request.user.is_anonymous() and f.registration_required:
|
if request.user.is_anonymous() and f.registration_required:
|
||||||
from django.views.auth.login import redirect_to_login
|
from django.views.auth.login import redirect_to_login
|
||||||
return redirect_to_login(request.path)
|
return redirect_to_login(request.path)
|
||||||
t = template_loader.select_template([f.template_name, 'flatfiles/default'])
|
if f.template_name:
|
||||||
|
t = template_loader.select_template((f.template_name, DEFAULT_TEMPLATE))
|
||||||
|
else:
|
||||||
|
t = template_loader.get_template(DEFAULT_TEMPLATE)
|
||||||
c = DjangoContext(request, {
|
c = DjangoContext(request, {
|
||||||
'flatfile': f,
|
'flatfile': f,
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user