diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2005-09-23 22:09:42 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2005-09-23 22:09:42 +0000 |
| commit | 3dcdce4d63e155d79a7ece80b14c5ab4358c98a9 (patch) | |
| tree | 93a0ad94ff409f56448002b33f47828982bd3915 /django/views | |
| parent | a39e6c91b1e2d158b9fb3481b4b239e2346d43ae (diff) | |
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
Diffstat (limited to 'django/views')
| -rw-r--r-- | django/views/core/flatfiles.py | 7 |
1 files changed, 6 insertions, 1 deletions
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, }) |
