Commit 4214a22e authored by Claude Paroz's avatar Claude Paroz
Browse files

[1.5.x] Fixed #19357 -- Allow non-ASCII chars in filesystem paths

Thanks kujiu for the report and Aymeric Augustin for the review.
Backport of c9166733 from master.
parent a0578a1a
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ from django.core import urlresolvers
from django.contrib.admindocs import utils
from django.contrib.sites.models import Site
from django.utils.importlib import import_module
from django.utils._os import upath
from django.utils import six
from django.utils.translation import ugettext as _
from django.utils.safestring import mark_safe
@@ -311,7 +312,7 @@ def load_all_installed_template_libraries():
        try:
            libraries = [
                os.path.splitext(p)[0]
                for p in os.listdir(os.path.dirname(mod.__file__))
                for p in os.listdir(os.path.dirname(upath(mod.__file__)))
                if p.endswith('.py') and p[0].isalpha()
            ]
        except OSError:
+2 −1
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ from django.contrib.auth.context_processors import PermWrapper, PermLookupDict
from django.db.models import Q
from django.test import TestCase
from django.test.utils import override_settings
from django.utils._os import upath


class MockUser(object):
@@ -63,7 +64,7 @@ class PermWrapperTests(TestCase):
@skipIfCustomUser
@override_settings(
    TEMPLATE_DIRS=(
            os.path.join(os.path.dirname(__file__), 'templates'),
            os.path.join(os.path.dirname(upath(__file__)), 'templates'),
        ),
    USE_TZ=False,                           # required for loading the fixture
    PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
+2 −1
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ from django.forms.fields import Field, EmailField
from django.test import TestCase
from django.test.utils import override_settings
from django.utils.encoding import force_text
from django.utils._os import upath
from django.utils import translation
from django.utils.translation import ugettext as _

@@ -331,7 +332,7 @@ class PasswordResetFormTest(TestCase):
        self.assertEqual(form.cleaned_data['email'], email)

    def test_custom_email_subject(self):
        template_path = os.path.join(os.path.dirname(__file__), 'templates')
        template_path = os.path.join(os.path.dirname(upath(__file__)), 'templates')
        with self.settings(TEMPLATE_DIRS=(template_path,)):
            data = {'email': 'testclient@example.com'}
            form = PasswordResetForm(data)
+2 −1
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ from django.http import QueryDict
from django.utils.encoding import force_text
from django.utils.html import escape
from django.utils.http import urlquote
from django.utils._os import upath
from django.test import TestCase
from django.test.utils import override_settings

@@ -27,7 +28,7 @@ from django.contrib.auth.tests.utils import skipIfCustomUser
    LANGUAGE_CODE='en',
    TEMPLATE_LOADERS=global_settings.TEMPLATE_LOADERS,
    TEMPLATE_DIRS=(
        os.path.join(os.path.dirname(__file__), 'templates'),
        os.path.join(os.path.dirname(upath(__file__)), 'templates'),
    ),
    USE_TZ=False,
    PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
+3 −2
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ from django.contrib.formtools.wizard import FormWizard
from django.test import TestCase
from django.test.html import parse_html
from django.test.utils import override_settings
from django.utils._os import upath
from django.utils import unittest

from django.contrib.formtools.tests.wizard import *
@@ -36,7 +37,7 @@ class TestFormPreview(preview.FormPreview):

@override_settings(
    TEMPLATE_DIRS=(
        os.path.join(os.path.dirname(__file__), 'templates'),
        os.path.join(os.path.dirname(upath(__file__)), 'templates'),
    ),
)
class PreviewTests(TestCase):
@@ -214,7 +215,7 @@ class DummyRequest(http.HttpRequest):
@override_settings(
    SECRET_KEY="123",
    TEMPLATE_DIRS=(
        os.path.join(os.path.dirname(__file__), 'templates'),
        os.path.join(os.path.dirname(upath(__file__)), 'templates'),
    ),
)
class WizardTests(TestCase):
Loading