diff options
| author | Tim Graham <timograham@gmail.com> | 2015-02-14 19:30:33 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-02-17 07:27:47 -0500 |
| commit | 4a0aeac1b5cfb7b6229a01119a596afb38d8a2a0 (patch) | |
| tree | 1c731c71252c2bfe7e718370853d9f6ffe194a47 | |
| parent | 8b39f33d78ce5749f8ca40a7ae6823b5f6c26c09 (diff) | |
Refs #24324 -- Fixed management command discovery on non-ASCII paths.
| -rw-r--r-- | django/core/management/__init__.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py index 9b8d9ad7d3..e0333eb2e9 100644 --- a/django/core/management/__init__.py +++ b/django/core/management/__init__.py @@ -13,8 +13,8 @@ from django.core.exceptions import ImproperlyConfigured from django.core.management.base import (BaseCommand, CommandError, CommandParser, handle_default_options) from django.core.management.color import color_style -from django.utils import lru_cache -from django.utils import six +from django.utils import lru_cache, six +from django.utils._os import npath, upath def find_commands(management_dir): @@ -25,7 +25,7 @@ def find_commands(management_dir): Returns an empty list if no commands are defined. """ command_dir = os.path.join(management_dir, 'commands') - return [name for _, name, is_pkg in pkgutil.iter_modules([command_dir]) + return [name for _, name, is_pkg in pkgutil.iter_modules([npath(command_dir)]) if not is_pkg and not name.startswith('_')] @@ -62,7 +62,7 @@ def get_commands(): The dictionary is cached on the first call and reused on subsequent calls. """ - commands = {name: 'django.core' for name in find_commands(__path__[0])} + commands = {name: 'django.core' for name in find_commands(upath(__path__[0]))} if not settings.configured: return commands |
