summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-02-18 13:48:31 (GMT)
committerGuido van Rossum <guido@python.org>1998-02-18 13:48:31 (GMT)
commit16a0bc278e34ca5b1b1717f21b9e6a4c4b2059f9 (patch)
tree3d1fbbb58c372fd49497c89b42b7d423a1e9f7fd
parent8cf94e608ee430fe82dd4a48f52392cb56e8bd7f (diff)
downloadcpython-16a0bc278e34ca5b1b1717f21b9e6a4c4b2059f9.zip
cpython-16a0bc278e34ca5b1b1717f21b9e6a4c4b2059f9.tar.gz
cpython-16a0bc278e34ca5b1b1717f21b9e6a4c4b2059f9.tar.bz2
(1) Change normpath() to *not* also call normcase().
(2) Fix normcase() to use string.lower() and string.replace() -- it turns out that the table constructed for translate() didn't work in locales that have a different number of lowercase and uppercase letters.
-rw-r--r--Lib/ntpath.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/Lib/ntpath.py b/Lib/ntpath.py
index 324ff2e..2543890 100644
--- a/Lib/ntpath.py
+++ b/Lib/ntpath.py
@@ -13,13 +13,13 @@ import string
# Other normalizations (such as optimizing '../' away) are not done
# (this is done by normpath).
-_normtable = string.maketrans(string.uppercase + "\\/",
- string.lowercase + os.sep * 2)
-
def normcase(s):
- """Normalize case of pathname. Makes all characters lowercase and all
-slashes into backslashes"""
- return string.translate(s, _normtable)
+ """Normalize case of pathname.
+
+ Makes all characters lowercase and all slashes into backslashes.
+
+ """
+ return string.lower(string.replace(s, "/", "\\"))
# Return wheter a path is absolute.
@@ -356,7 +356,7 @@ are left unchanged"""
def normpath(path):
"""Normalize path, eliminating double slashes, etc."""
- path = normcase(path)
+ path = string.replace(path, "/", "\\")
prefix, path = splitdrive(path)
while path[:1] == os.sep:
prefix = prefix + os.sep