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

[1.6.x] Replaced "not PY3" by "PY2", new in six 1.4.0.

Conflicts:
	django/db/backends/oracle/base.py
	django/db/backends/sqlite3/base.py
	django/db/models/base.py

Backport of 365c3e8b from master.
This commit is contained in:
Aymeric Augustin
2013-09-02 12:06:32 +02:00
parent 50012577f3
commit 115318051c
27 changed files with 48 additions and 50 deletions

View File

@@ -15,7 +15,7 @@ from django.utils.importlib import import_module
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)