summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2012-08-08 13:07:49 +0200
committerAymeric Augustin <aymeric.augustin@m4x.org>2012-08-08 13:07:49 +0200
commitfa4cb348170134fce7e99eedf497ee8f5e0fe165 (patch)
tree4cbb74be036c3740cb65b8b819283dcb3ae31f01
parenta4abe7ed56d44418c8203b4605085caf9b349654 (diff)
[py3] Fixed filesystem encoding handling
in the app directories template loader.
-rw-r--r--django/template/loaders/app_directories.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/django/template/loaders/app_directories.py b/django/template/loaders/app_directories.py
index 6e0f079de7..887f8a0b72 100644
--- a/django/template/loaders/app_directories.py
+++ b/django/template/loaders/app_directories.py
@@ -12,9 +12,11 @@ from django.template.base import TemplateDoesNotExist
from django.template.loader import BaseLoader
from django.utils._os import safe_join
from django.utils.importlib import import_module
+from django.utils import six
# At compile time, cache the directories to search.
-fs_encoding = sys.getfilesystemencoding() or sys.getdefaultencoding()
+if not six.PY3:
+ fs_encoding = sys.getfilesystemencoding() or sys.getdefaultencoding()
app_template_dirs = []
for app in settings.INSTALLED_APPS:
try:
@@ -23,7 +25,9 @@ for app in settings.INSTALLED_APPS:
raise ImproperlyConfigured('ImportError %s: %s' % (app, e.args[0]))
template_dir = os.path.join(os.path.dirname(mod.__file__), 'templates')
if os.path.isdir(template_dir):
- app_template_dirs.append(template_dir.decode(fs_encoding))
+ if not six.PY3:
+ template_dir = template_dir.decode(fs_encoding)
+ app_template_dirs.append(template_dir)
# It won't change, so convert it to a tuple to save memory.
app_template_dirs = tuple(app_template_dirs)