[Patches] [ python-Patches-957650 ] Fix for bugs relating to ntpath.expanduser()

SourceForge.net noreply at sourceforge.net
Sun Oct 22 23:25:56 CEST 2006


Patches item #957650, was opened at 2004-05-20 13:35
Message generated for change (Comment added) made by josiahcarlson
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: Open
Resolution: None
Priority: 5
Submitted By: Josiah Carlson (josiahcarlson)
Assigned to: Kurt B. Kaiser (kbk)
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: Josiah Carlson (josiahcarlson)
Date: 2006-10-22 14: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 03:46

Message:
Logged In: YES 
user_id=6656

bugger, wrong report :-/

----------------------------------------------------------------------

Comment By: Michael Hudson (mwh)
Date: 2004-06-15 03:45

Message:
Logged In: YES 
user_id=6656

This looks much better to me!

----------------------------------------------------------------------

Comment By: Josiah Carlson (josiahcarlson)
Date: 2004-06-14 18: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 13:44

Message:
Logged In: YES 
user_id=943591

this problem maybe is whats
needed

----------------------------------------------------------------------

Comment By: Josiah Carlson (josiahcarlson)
Date: 2004-05-20 13: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 13: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