Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Made a small improvement to django.views.core.flatfiles so that it on…

…ly 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
  • Loading branch information...
commit 3dcdce4d63e155d79a7ece80b14c5ab4358c98a9 1 parent a39e6c9
@adrianholovaty adrianholovaty authored
Showing with 6 additions and 1 deletion.
  1. +6 −1 django/views/core/flatfiles.py
View
7 django/views/core/flatfiles.py
@@ -4,6 +4,8 @@
from django.utils.httpwrappers import HttpResponse
from django.conf.settings import SITE_ID
+DEFAULT_TEMPLATE = 'flatfiles/default'
+
def flat_file(request, url):
"""
Flat file view
@@ -23,7 +25,10 @@ def flat_file(request, url):
if request.user.is_anonymous() and f.registration_required:
from django.views.auth.login import redirect_to_login
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, {
'flatfile': f,
})
Please sign in to comment.
Something went wrong with that request. Please try again.