[issue2244] urllib and urllib2 decode userinfo multiple times

2010-07-31 Thread Theodore Turocy

Theodore Turocy  added the comment:

I am attaching a patch against py3k which adds some tests to demonstrate the 
original bug when issuing a Request() to a ftp:// URL.

To do this, the tests add checks for user and passwd.  The previous version of 
checks asserted that the .user and .passwd of the returned request should be 
"".  Checking .user is necessary to verify the original bug.  

I was confused by a comment in the fixture, "ftp authentication not yet 
implemented by FTPHandler", which appeared to justify the assumption that .user 
and .passwd must be "".  This may be true, but .user and .passwd are being set 
by the Request.  The test includes the minimal augmentation to extend on the 
original behavior of the test.  Someone with greater knowledge than I might 
look at that comment to see if it is out-of-date, or simply too vague.

--
nosy: +ted.turocy
Added file: http://bugs.python.org/file18295/urllib_ftptests_doubleencode.patch

___
Python tracker 
<http://bugs.python.org/issue2244>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9444] argparse does not honor prefix_chars when adding default options

2010-07-31 Thread Theodore Turocy

Theodore Turocy  added the comment:

What is the appropriate behavior for long options when '-' is not one of the 
accepted prefix_chars?  All of '-h', '--help', '-v', and '--version' are 
hardcoded in the ctor.  If, for instance, prefix_chars='+', should the long 
options be '++help', or should long options simply be disabled?

Also, for backwards compatibility, to implement Doug Hellmann's suggestion, '-' 
should be used for '-h' and '--help' whenever '-' is listed in prefix_chars 
(so, e.g., prefix_chars='+-' will result in the same behavior as previous 
versions). 

I have a working patch for this but wouldn't mind someone else's thoughts first.

--
nosy: +ted.turocy

___
Python tracker 
<http://bugs.python.org/issue9444>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9444] argparse does not honor prefix_chars when adding default options

2010-07-31 Thread Theodore Turocy

Theodore Turocy  added the comment:

Looking at the test fixtures that exercise argparse, it appears that the 
intended behavior when '-' is not a prefix_char is to accept a doubling of any 
of the prefix_chars for long arguments.  That is, if '-' is not present in 
prefix_chars but ':' is, then an argument like '::help' would be a valid long 
argument.

I'm attaching a patch which fixes the originally reported problem as follows:

* If '-' is in prefix_chars, then the help and version arguments are '-h', 
'--help', '-v', '--version'
* If '-' is not in prefix_chars, then the first char in prefix_chars is used to 
lead the option, e.g., '+h', '++help', '+v', '++version' if prefix_chars starts 
with '+'.

Catherine Devlin is also sprinting here at PyOhio and will have a test fixture 
separately.

--
keywords: +patch
Added file: http://bugs.python.org/file18298/argparse_char_fix.patch

___
Python tracker 
<http://bugs.python.org/issue9444>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9444] argparse does not honor prefix_chars when adding default options

2010-08-01 Thread Theodore Turocy

Theodore Turocy  added the comment:

I was less than clear in what I wrote last night, Doug.  What I mean is that 
the idiom "::foo" for a long argument, instead of the more standard-looking 
"--foo", appears in the test suite.  This suggests to me that the intended 
behavior for the default help option should be to use a doubled prefix 
character in front of the long-form option.

For instance, if prefix_chars='+' and add_help=True, then the automatically 
provided help arguments will be '+h' and '++help'.

Certainly, if one explicitly adds an option '//myopt', we would not expect 
'::myopt' to also be accepted.  I'm talking here only about the options that 
argparse adds as a convenience.

--

___
Python tracker 
<http://bugs.python.org/issue9444>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9444] argparse does not honor prefix_chars when adding default options

2010-08-01 Thread Theodore Turocy

Theodore Turocy  added the comment:

I'm uploading a new version of my patch which includes a proposed clarification 
to the documentation about the behavior in this case.  Doug, does this make the 
documentation clearer to you?  It is now explicit about the behavior for 
formulating the help option if '-' is not in prefix_chars.

--
Added file: http://bugs.python.org/file18317/argparse_char_fix+doc.patch

___
Python tracker 
<http://bugs.python.org/issue9444>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com