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

SourceForge.net noreply at sourceforge.net
Mon Jun 14 21:11:02 EDT 2004


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

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Josiah Carlson (josiahcarlson)
Assigned to: Nobody/Anonymous (nobody)
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: 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