summaryrefslogtreecommitdiff
path: root/django/utils/_os.py
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2017-01-20 08:01:02 -0500
committerGitHub <noreply@github.com>2017-01-20 08:01:02 -0500
commit4e729feaa647547f25debb1cb63dec989dc41a20 (patch)
tree7c7a38c5961bf4daf98a8cb47dc74c769563ffcf /django/utils/_os.py
parentec4c1d6717da7a9d09d5b3ce84cccac819bb592c (diff)
Refs #23919 -- Removed django.utils._os.upath()/npath()/abspathu() usage.
These functions do nothing on Python 3.
Diffstat (limited to 'django/utils/_os.py')
-rw-r--r--django/utils/_os.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/django/utils/_os.py b/django/utils/_os.py
index 6507e58764..8309e08fbf 100644
--- a/django/utils/_os.py
+++ b/django/utils/_os.py
@@ -5,20 +5,19 @@ from os.path import abspath, dirname, join, normcase, sep
from django.core.exceptions import SuspiciousFileOperation
from django.utils.encoding import force_text
+# For backwards-compatibility in Django 2.0
abspathu = abspath
def upath(path):
- """
- Always return a unicode path.
- """
+ """Always return a unicode path (did something for Python 2)."""
return path
def npath(path):
"""
Always return a native path, that is unicode on Python 3 and bytestring on
- Python 2.
+ Python 2. Noop for Python 3.
"""
return path
@@ -33,8 +32,8 @@ def safe_join(base, *paths):
"""
base = force_text(base)
paths = [force_text(p) for p in paths]
- final_path = abspathu(join(base, *paths))
- base_path = abspathu(base)
+ final_path = abspath(join(base, *paths))
+ base_path = abspath(base)
# Ensure final_path starts with base_path (using normcase to ensure we
# don't false-negative on case insensitive operating systems like Windows),
# further, one of the following conditions must be true: