From 3dcdce4d63e155d79a7ece80b14c5ab4358c98a9 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Fri, 23 Sep 2005 22:09:42 +0000 Subject: [PATCH] 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 --- django/views/core/flatfiles.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/django/views/core/flatfiles.py b/django/views/core/flatfiles.py index af5aa5bce2..ded33d4cdd 100644 --- a/django/views/core/flatfiles.py +++ b/django/views/core/flatfiles.py @@ -4,6 +4,8 @@ from django.models.core import flatfiles 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, })