diff options
| author | Tim Graham <timograham@gmail.com> | 2017-01-20 08:01:02 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-01-20 08:01:02 -0500 |
| commit | 4e729feaa647547f25debb1cb63dec989dc41a20 (patch) | |
| tree | 7c7a38c5961bf4daf98a8cb47dc74c769563ffcf /django/core | |
| parent | ec4c1d6717da7a9d09d5b3ce84cccac819bb592c (diff) | |
Refs #23919 -- Removed django.utils._os.upath()/npath()/abspathu() usage.
These functions do nothing on Python 3.
Diffstat (limited to 'django/core')
| -rw-r--r-- | django/core/files/storage.py | 4 | ||||
| -rw-r--r-- | django/core/management/__init__.py | 5 | ||||
| -rw-r--r-- | django/core/management/commands/compilemessages.py | 7 | ||||
| -rw-r--r-- | django/core/management/commands/loaddata.py | 3 | ||||
| -rw-r--r-- | django/core/management/commands/makemessages.py | 3 |
5 files changed, 9 insertions, 13 deletions
diff --git a/django/core/files/storage.py b/django/core/files/storage.py index 6f2d6bfd91..a8814ddc48 100644 --- a/django/core/files/storage.py +++ b/django/core/files/storage.py @@ -9,7 +9,7 @@ from django.core.files import File, locks from django.core.files.move import file_move_safe from django.core.signals import setting_changed from django.utils import timezone -from django.utils._os import abspathu, safe_join +from django.utils._os import safe_join from django.utils.crypto import get_random_string from django.utils.deconstruct import deconstructible from django.utils.encoding import filepath_to_uri, force_text @@ -201,7 +201,7 @@ class FileSystemStorage(Storage): @cached_property def location(self): - return abspathu(self.base_location) + return os.path.abspath(self.base_location) @cached_property def base_url(self): diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py index 1b59dac686..ce0903dbdf 100644 --- a/django/core/management/__init__.py +++ b/django/core/management/__init__.py @@ -14,7 +14,6 @@ from django.core.management.base import ( ) from django.core.management.color import color_style from django.utils import autoreload -from django.utils._os import npath, upath from django.utils.encoding import force_text @@ -26,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([npath(command_dir)]) + return [name for _, name, is_pkg in pkgutil.iter_modules([command_dir]) if not is_pkg and not name.startswith('_')] @@ -63,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(upath(__path__[0]))} + commands = {name: 'django.core' for name in find_commands(__path__[0])} if not settings.configured: return commands diff --git a/django/core/management/commands/compilemessages.py b/django/core/management/commands/compilemessages.py index 05fb9e5cfc..c5c7f22583 100644 --- a/django/core/management/commands/compilemessages.py +++ b/django/core/management/commands/compilemessages.py @@ -4,7 +4,6 @@ import os from django.core.management.base import BaseCommand, CommandError from django.core.management.utils import find_command, popen_wrapper -from django.utils._os import npath, upath def has_bom(fn): @@ -62,7 +61,7 @@ class Command(BaseCommand): basedirs = [os.path.join('conf', 'locale'), 'locale'] if os.environ.get('DJANGO_SETTINGS_MODULE'): from django.conf import settings - basedirs.extend(upath(path) for path in settings.LOCALE_PATHS) + basedirs.extend(settings.LOCALE_PATHS) # Walk entire tree, looking for locale directories for dirpath, dirnames, filenames in os.walk('.', topdown=True): @@ -115,13 +114,13 @@ class Command(BaseCommand): base_path = os.path.splitext(po_path)[0] # Check writability on first location - if i == 0 and not is_writable(npath(base_path + '.mo')): + if i == 0 and not is_writable(base_path + '.mo'): self.stderr.write("The po files under %s are in a seemingly not writable location. " "mo files will not be updated/created." % dirpath) return args = [self.program] + self.program_options + [ - '-o', npath(base_path + '.mo'), npath(base_path + '.po') + '-o', base_path + '.mo', base_path + '.po' ] output, errors, status = popen_wrapper(args) if status: diff --git a/django/core/management/commands/loaddata.py b/django/core/management/commands/loaddata.py index 9edd642b43..4556d9b9d8 100644 --- a/django/core/management/commands/loaddata.py +++ b/django/core/management/commands/loaddata.py @@ -17,7 +17,6 @@ from django.db import ( DEFAULT_DB_ALIAS, DatabaseError, IntegrityError, connections, router, transaction, ) -from django.utils._os import upath from django.utils.encoding import force_text from django.utils.functional import cached_property @@ -287,7 +286,7 @@ class Command(BaseCommand): dirs.append(app_dir) dirs.extend(list(fixture_dirs)) dirs.append('') - dirs = [upath(os.path.abspath(os.path.realpath(d))) for d in dirs] + dirs = [os.path.abspath(os.path.realpath(d)) for d in dirs] return dirs def parse_name(self, fixture_name): diff --git a/django/core/management/commands/makemessages.py b/django/core/management/commands/makemessages.py index 48ed70845a..5b74ddaa0d 100644 --- a/django/core/management/commands/makemessages.py +++ b/django/core/management/commands/makemessages.py @@ -14,7 +14,6 @@ from django.core.management.base import BaseCommand, CommandError from django.core.management.utils import ( find_command, handle_extensions, popen_wrapper, ) -from django.utils._os import upath from django.utils.encoding import DEFAULT_LOCALE_ENCODING from django.utils.functional import cached_property from django.utils.jslex import prepare_js_for_gettext @@ -638,7 +637,7 @@ class Command(BaseCommand): the msgs string, inserting it at the right place. msgs should be the contents of a newly created .po file. """ - django_dir = os.path.normpath(os.path.join(os.path.dirname(upath(django.__file__)))) + django_dir = os.path.normpath(os.path.join(os.path.dirname(django.__file__))) if self.domain == 'djangojs': domains = ('djangojs', 'django') else: |
