]> granicus.if.org Git - python/commitdiff
(1) Change normpath() to *not* also call normcase().
authorGuido van Rossum <guido@python.org>
Wed, 18 Feb 1998 13:48:31 +0000 (13:48 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 18 Feb 1998 13:48:31 +0000 (13:48 +0000)
(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.

Lib/ntpath.py

index 324ff2e3ec27b57799561f091123deb7169a4f89..2543890c35e1f8ef1f587788134d816f393d545e 100644 (file)
@@ -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