1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Replaced "not PY3" by "PY2", new in six 1.4.0.

This commit is contained in:
Aymeric Augustin
2013-09-02 12:06:32 +02:00
parent 4292097078
commit 365c3e8b73
27 changed files with 47 additions and 49 deletions

View File

@@ -15,7 +15,7 @@ from django.utils._os import safe_join
from django.utils import six
# At compile time, cache the directories to search.
if not six.PY3:
if six.PY2:
fs_encoding = sys.getfilesystemencoding() or sys.getdefaultencoding()
app_template_dirs = []
for app in settings.INSTALLED_APPS:
@@ -25,7 +25,7 @@ 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):
if not six.PY3:
if six.PY2:
template_dir = template_dir.decode(fs_encoding)
app_template_dirs.append(template_dir)

View File

@@ -27,7 +27,7 @@ class Loader(BaseLoader):
resource = resource_string(app, pkg_name)
except Exception:
continue
if not six.PY3:
if six.PY2:
resource = resource.decode(settings.FILE_CHARSET)
return (resource, 'egg:%s:%s' % (app, pkg_name))
raise TemplateDoesNotExist(template_name)