[Patches] [ python-Patches-957650 ] Fix for bugs relating to ntpath.expanduser()
SourceForge.net
noreply at sourceforge.net
Tue Mar 13 23:08:06 CET 2007
Patches item #957650, was opened at 2004-05-20 20:35
Message generated for change (Comment added) made by gbrandl
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=957650&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 5
Private: No
Submitted By: Josiah Carlson (josiahcarlson)
>Assigned to: Georg Brandl (gbrandl)
Summary: Fix for bugs relating to ntpath.expanduser()
Initial Comment:
Attached is a patch for sf bug #796219 that fixes
ntpath.expanduser() for paths that embed other
environment variables, and also includes functionality
that mirrors *nix-style ~user\extra expansions.
I will comment with output from both the unpatched and
patched version of ntpath.
----------------------------------------------------------------------
>Comment By: Georg Brandl (gbrandl)
Date: 2007-03-13 22:08
Message:
Logged In: YES
user_id=849994
Originator: NO
Thanks! Committed as rev. 54364.
----------------------------------------------------------------------
Comment By: Josiah Carlson (josiahcarlson)
Date: 2007-03-13 20:49
Message:
Logged In: YES
user_id=341410
Originator: YES
I have just attached an updated patch (against trunk) for ntpath
expandusers and expandvars that includes documentation and test updates.
File Added: ntpath_full.patch
----------------------------------------------------------------------
Comment By: Georg Brandl (gbrandl)
Date: 2007-03-13 08:41
Message:
Logged In: YES
user_id=849994
Originator: NO
This fixes #796219.
----------------------------------------------------------------------
Comment By: Georg Brandl (gbrandl)
Date: 2007-03-13 08:39
Message:
Logged In: YES
user_id=849994
Originator: NO
The patch looks good to me; documentation updates and new tests will be
needed though.
----------------------------------------------------------------------
Comment By: Josiah Carlson (josiahcarlson)
Date: 2006-10-22 21:25
Message:
Logged In: YES
user_id=341410
I've just attached an updated version of the patch to handle
expandusers (without recursive environment variable
expansion), as well as a variant of
http://python.org/sf/1574252 to handle %VAR% style
expansions on Windows.
----------------------------------------------------------------------
Comment By: Michael Hudson (mwh)
Date: 2004-06-15 10:46
Message:
Logged In: YES
user_id=6656
bugger, wrong report :-/
----------------------------------------------------------------------
Comment By: Michael Hudson (mwh)
Date: 2004-06-15 10:45
Message:
Logged In: YES
user_id=6656
This looks much better to me!
----------------------------------------------------------------------
Comment By: Josiah Carlson (josiahcarlson)
Date: 2004-06-15 01:11
Message:
Logged In: YES
user_id=341410
What problem is needed?
Perhaps you mean "this solution is desireable".
----------------------------------------------------------------------
Comment By: alan johnson (chomo)
Date: 2004-06-14 20:44
Message:
Logged In: YES
user_id=943591
this problem maybe is whats
needed
----------------------------------------------------------------------
Comment By: Josiah Carlson (josiahcarlson)
Date: 2004-05-20 20:38
Message:
Logged In: YES
user_id=341410
I uploaded the testing as text to alleviate text wrapping
issues that could confuse.
----------------------------------------------------------------------
Comment By: Josiah Carlson (josiahcarlson)
Date: 2004-05-20 20:36
Message:
Logged In: YES
user_id=341410
#test setup:
>>> import os
>>> os.environ['TESTING'] = '%TESTING1%'
>>> os.environ['TESTING1'] = '%TESTING2%'
>>> os.environ['TESTING2'] = 'Final\\Path'
#test standard ntpath
>>> import ntpath
>>> ntpath.expanduser('~')
'C:\\Documents and Settings\\jcarlson'
>>> ntpath.expanduser('~billy')
'~billy'
>>> ntpath.expanduser('~billy\\bob')
'~billy\\bob'
>>> ntpath.expanduser('~\\bob')
'C:\\Documents and Settings\\jcarlson\\bob'
>>>
ntpath.expanduser('~billy\\%TESTING%\\%TESTING1%\\%TESTING2%')
'~billy\\%TESTING%\\%TESTING1%\\%TESTING2%'
#test patched ntpath
>>> import ntpath_patched
>>> ntpath_patched.expanduser('~')
'C:Documents and Settings\\jcarlson'
>>> ntpath_patched.expanduser('~billy')
'C:Documents and Settings\\billy'
>>> ntpath_patched.expanduser('~billy\\bob')
'C:Documents and Settings\\billy\\bob'
>>> ntpath_patched.expanduser('~\\bob')
'C:Documents and Settings\\jcarlson\\bob'
>>>
ntpath_patched.expanduser('~billy\\%TESTING%\\%TESTING1%\\%TESTING2%')
'C:Documents and
Settings\\billy\\Final\\Path\\Final\\Path\\Final\\Path'
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=957650&group_id=5470
More information about the Patches
mailing list