Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Adrian Holovaty authored September 23, 2005

Showing 1 changed file with 6 additions and 1 deletion. Show diff stats Hide diff stats

  1. 7  django/views/core/flatfiles.py
7  django/views/core/flatfiles.py
@@ -4,6 +4,8 @@
4 4
 from django.utils.httpwrappers import HttpResponse
5 5
 from django.conf.settings import SITE_ID
6 6
 
  7
+DEFAULT_TEMPLATE = 'flatfiles/default'
  8
+
7 9
 def flat_file(request, url):
8 10
     """
9 11
     Flat file view
@@ -23,7 +25,10 @@ def flat_file(request, url):
23 25
     if request.user.is_anonymous() and f.registration_required:
24 26
         from django.views.auth.login import redirect_to_login
25 27
         return redirect_to_login(request.path)
26  
-    t = template_loader.select_template([f.template_name, 'flatfiles/default'])
  28
+    if f.template_name:
  29
+        t = template_loader.select_template((f.template_name, DEFAULT_TEMPLATE))
  30
+    else:
  31
+        t = template_loader.get_template(DEFAULT_TEMPLATE)
27 32
     c = DjangoContext(request, {
28 33
         'flatfile': f,
29 34
     })

0 notes on commit 3dcdce4

Please sign in to comment.
Something went wrong with that request. Please try again.