diff options
| author | Claude Paroz <claude@2xlibre.net> | 2012-12-08 11:13:52 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2012-12-08 11:13:52 +0100 |
| commit | c91667338a4e774e2819ccf4da852dc7b759bc19 (patch) | |
| tree | 42a700d237c85ac2b647999d02d3dcd7d8047068 /django/db | |
| parent | 53b879f045f0e55cc8f4bedff67b5a14f3057561 (diff) | |
Fixed #19357 -- Allow non-ASCII chars in filesystem paths
Thanks kujiu for the report and Aymeric Augustin for the review.
Diffstat (limited to 'django/db')
| -rw-r--r-- | django/db/models/loading.py | 5 | ||||
| -rw-r--r-- | django/db/utils.py | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/django/db/models/loading.py b/django/db/models/loading.py index a0510acc6d..56edc36bec 100644 --- a/django/db/models/loading.py +++ b/django/db/models/loading.py @@ -5,6 +5,7 @@ from django.core.exceptions import ImproperlyConfigured from django.utils.datastructures import SortedDict from django.utils.importlib import import_module from django.utils.module_loading import module_has_submodule +from django.utils._os import upath from django.utils import six import imp @@ -244,8 +245,8 @@ class AppCache(object): # The same model may be imported via different paths (e.g. # appname.models and project.appname.models). We use the source # filename as a means to detect identity. - fname1 = os.path.abspath(sys.modules[model.__module__].__file__) - fname2 = os.path.abspath(sys.modules[model_dict[model_name].__module__].__file__) + fname1 = os.path.abspath(upath(sys.modules[model.__module__].__file__)) + fname2 = os.path.abspath(upath(sys.modules[model_dict[model_name].__module__].__file__)) # Since the filename extension could be .py the first time and # .pyc or .pyo the second time, ignore the extension when # comparing. diff --git a/django/db/utils.py b/django/db/utils.py index a91298626b..842fd354d6 100644 --- a/django/db/utils.py +++ b/django/db/utils.py @@ -5,6 +5,7 @@ from threading import local from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.utils.importlib import import_module +from django.utils._os import upath from django.utils import six @@ -27,7 +28,7 @@ def load_backend(backend_name): except ImportError as e_user: # The database backend wasn't found. Display a helpful error message # listing all possible (built-in) database backends. - backend_dir = os.path.join(os.path.dirname(__file__), 'backends') + backend_dir = os.path.join(os.path.dirname(upath(__file__)), 'backends') try: builtin_backends = [ name for _, name, ispkg in pkgutil.iter_modules([backend_dir]) |
