diff options
author | Guido van Rossum <guido@python.org> | 1993-07-06 15:19:36 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1993-07-06 15:19:36 (GMT) |
commit | df5638662d95c08d48da0ac236dec4e44e93874e (patch) | |
tree | eecddf3bcbd5da4f4a5a922a577500f3ab4095db /Lib | |
parent | f1dc56632881fe4e5beed047580bf927679f3669 (diff) | |
download | cpython-df5638662d95c08d48da0ac236dec4e44e93874e.zip cpython-df5638662d95c08d48da0ac236dec4e44e93874e.tar.gz cpython-df5638662d95c08d48da0ac236dec4e44e93874e.tar.bz2 |
* posixpath.py: Fix border cases in normpath ('/foo/..' should return '/')
* ftplib.py: made cwd() use 'CDUP' when dirname is '..'
* FL.py: added new constant FL_PLACE_FULLSCREEN
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/ftplib.py | 6 | ||||
-rwxr-xr-x | Lib/irix5/FL.py | 1 | ||||
-rwxr-xr-x | Lib/plat-irix5/FL.py | 1 | ||||
-rw-r--r-- | Lib/posixpath.py | 12 |
4 files changed, 14 insertions, 6 deletions
diff --git a/Lib/ftplib.py b/Lib/ftplib.py index e846ffe..8342b09 100644 --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -336,7 +336,11 @@ class FTP: # Change to a directory def cwd(self, dirname): - self.voidcmd('CWD ' + dirname) + if dirname == '..': + cmd = 'CDUP' + else: + cmd = 'CWD ' + dirname + self.voidcmd(cmd) # Retrieve the size of a file def size(self, filename): diff --git a/Lib/irix5/FL.py b/Lib/irix5/FL.py index 65184df..f85237b 100755 --- a/Lib/irix5/FL.py +++ b/Lib/irix5/FL.py @@ -27,6 +27,7 @@ PLACE_ASPECT = 2 PLACE_MOUSE = 3 PLACE_CENTER = 4 PLACE_POSITION = 5 +FL_PLACE_FULLSCREEN = 6 FIND_INPUT = 0 FIND_AUTOMATIC = 1 FIND_MOUSE = 2 diff --git a/Lib/plat-irix5/FL.py b/Lib/plat-irix5/FL.py index 65184df..f85237b 100755 --- a/Lib/plat-irix5/FL.py +++ b/Lib/plat-irix5/FL.py @@ -27,6 +27,7 @@ PLACE_ASPECT = 2 PLACE_MOUSE = 3 PLACE_CENTER = 4 PLACE_POSITION = 5 +FL_PLACE_FULLSCREEN = 6 FIND_INPUT = 0 FIND_AUTOMATIC = 1 FIND_MOUSE = 2 diff --git a/Lib/posixpath.py b/Lib/posixpath.py index 57b0af6..96116d1 100644 --- a/Lib/posixpath.py +++ b/Lib/posixpath.py @@ -270,10 +270,12 @@ def expandvars(path): def normpath(path): import string + # Treat initial slashes specially + slashes = '' + while path[:1] == '/': + slashes = slashes + '/' + path = path[1:] comps = string.splitfields(path, '/') - # If the path begins with '/', comps[0] is '', which we leave alone; - # we also leave leading multiple slashes alone for compatibility - # with certain networking naming schemes using //host/path i = 0 while i < len(comps): if comps[i] == '.': @@ -287,6 +289,6 @@ def normpath(path): else: i = i+1 # If the path is now empty, substitute '.' - if not comps: + if not comps and not slashes: comps.append('.') - return string.joinfields(comps, '/') + return slashes + string.joinfields(comps, '/') |