[issue9217] 2to3 crashes with some doctests

2010-09-04 Thread Jeremy Thurgood

Jeremy Thurgood  added the comment:

This seems to be fixed in 3.2 and the 2.7 maintenance branch, but here's a 
(one-liner) patch for people who want to fix their local installations.

--
keywords: +patch
nosy: +jerith
Added file: http://bugs.python.org/file18750/2to3_log_fix.patch

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



[issue9997] function named 'top' gets unexpected namespace/scope behaviour

2010-10-01 Thread Jeremy Thurgood

Changes by Jeremy Thurgood :


--
nosy: +jerith

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



[issue10231] SimpleHTTPRequestHandler directory bugs

2010-11-20 Thread Jeremy Thurgood

Jeremy Thurgood  added the comment:

Attached a patch to test for and fix the first two issues described in this 
ticket.

Basically, it modifies SimpleHTTPRequestHandler.send_head() to operate on a 
path already stripped of the query string and fragment rather than the 
completely unparsed URL.

--
keywords: +patch
nosy: +jerith
Added file: http://bugs.python.org/file19654/issue10231.diff

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



[issue1859] textwrap doesn't linebreak on "\n"

2010-11-20 Thread Jeremy Thurgood

Jeremy Thurgood  added the comment:

The weird behaviour is caused by newlines being treated as normal whitespace 
characters and not actually causing _wrap_chunks() to break the line. This 
means that it builds "lines" of up to 'width' characters which may contain 
newlines:

>>> text = '''\
... aaa aaa aaa
... bbb bbb bbb
... ccc ccc ccc
... ddd ddd ddd'''
>>> T = TextWrapper(replace_whitespace=False, width=17)
>>> T.wrap(text)
['aaa aaa aaa\nbbb', 'bbb bbb\nccc ccc', 'ccc\nddd ddd ddd']
>>> for line in T.wrap(text): print(line)
... 
aaa aaa aaa
bbb
bbb bbb
ccc ccc
ccc
ddd ddd ddd

There's no clean way to deal with this inside _wrap_chunks() (as Greg implied), 
so I think we should just document the existing behaviour and recommend the 
splitlines() workaround.

It might be useful to add a wrap_paragraphs() convenience function that does 
the split/wrap/join, but I don't think that would add enough value to be worth 
the change.

--
nosy: +jerith

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



[issue1859] textwrap doesn't linebreak on "\n"

2010-11-20 Thread Jeremy Thurgood

Jeremy Thurgood  added the comment:

Here's a doc patch for py3k. A similar patch for 2.7 (and other versions?) 
might be a good idea.

--
keywords: +patch
Added file: http://bugs.python.org/file19676/issue1859_docs.diff

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



[issue10231] SimpleHTTPRequestHandler directory bugs

2010-11-20 Thread Jeremy Thurgood

Jeremy Thurgood  added the comment:

Thanks for the comments.

There are two separate things here: the URL and the filesystem path. The only 
part of the URL we care about is the path section, but the fragment ("#anchor") 
and query parameters ("?foo") are valid -- SimpleHTTPRequestHandler just 
ignores them. translate_path() turns the URL into the filesystem path, which 
may be a file or a directory, by extracting the URL path and mapping it onto 
the filesystem.

The bug is that the fragment and query parameters are stripped in 
translate_path(), but are *not* stripped when manipulating the URL for the 
redirect.

This means that when the URL is "/something?foo" and the cwd is "/tmp", the 
filesystem path is "/tmp/something" (which is a directory) and therefore the 
response needs to be a redirect. The redirect needs to modify the path section 
of the URL (which is "/something") to add a slash. This means the redirect 
needs to be to "/something/" (or "/something/?foo" if you want to preserve the 
query parameters) rather than "/something?foo/" which is what the current 
implementation does.

translate_path() unescapes the URL path before mapping it to the filesystem, 
which means that "/something%3Ffoo" (and even "/something%3Ffoo?bar") will be 
turned into the filesystem path "/tmp/something?foo".

I'll add some tests for the "/something%3Ffoo" case and possibly update 
send_head() to preserve the fragment and query parameters on redirect.

--
status: pending -> open

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



[issue10231] SimpleHTTPRequestHandler directory bugs

2010-11-20 Thread Jeremy Thurgood

Jeremy Thurgood  added the comment:

Updated patch as per previous comment.

--
Added file: http://bugs.python.org/file19701/issue10231_v2.diff

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



[issue10231] SimpleHTTPRequestHandler directory bugs

2010-11-21 Thread Jeremy Thurgood

Jeremy Thurgood  added the comment:

On Sun, Nov 21, 2010 at 10:37, Senthil Kumaran  wrote:
> Now, what happens when you type "http://bugs.python.org?10231"; [1] in
> your browser? According to this bug report, the server should 301
> redirect it to "http://bugs.python.org/?10231";. If you try this, this
> does not happen. The browser (client) is in fact, changing it to the
> corrected URL (because the original is invalid) and the server is just
> ignoring the so called query portion).

I see your point now, but I don't agree with it completely. It seems
reasonable to allow query parameters to specify things like sort order
for a directory listing or have a fragment to focus the browser on a
particular entry. On the other hand, if we don't want to support the
redirect with a fragment or query parameters, we should instead return
a 400 response. I can't see any situation in which redirecting
"/something?foo" to "/something?foo/" is the correct behaviour.

> If you use, urllib2 to request the above [1], you will find that it
> will fail with 401 error.

A 401 is "Unauthorized", which means the server is asking for
authentication -- I don't think that's relevant here.

--

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



[issue10231] SimpleHTTPRequestHandler directory bugs

2010-11-21 Thread Jeremy Thurgood

Jeremy Thurgood  added the comment:

On Sun, Nov 21, 2010 at 17:11, Senthil Kumaran wrote:

>>I can't see any situation in which redirecting
>> "/something?foo" to "/something?foo/" is the correct behaviour.

> As I explained, in the previous post, this would *not happen* in
> practical scenarios, because code won't reach that point for valid
> URLs.

It reaches that point in the tests I added, and the results confirm
the first two points in the original bug report. Am I mistaken?

"/something?foo" is a valid URL. If "/something" is translated to a
file on the filesystem, the content of that file is returned. If it is
translated to a directory on the filesystem, a 301 to
"/something?foo/" is returned.

--

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



[issue1524825] ConfigParser: accept leading whitespace on options+comments

2008-05-10 Thread Jeremy Thurgood

Jeremy Thurgood <[EMAIL PROTECTED]> added the comment:

This looks very much like a duplicate of issue 1714. Perhaps the two
should be merged?

--
nosy: +jerith

_
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1524825>
_
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1491] BaseHTTPServer incorrectly implements response code 100

2008-05-10 Thread Jeremy Thurgood

Jeremy Thurgood <[EMAIL PROTECTED]> added the comment:

Added handling for "Expect: 100-continue" header to
BaseHTTPRequestHandler. By default, any request that has this header
gets a 100 Continue response (with no other headers) before
do_WHATEVER() is called. By overriding handle_expect_100(), you can
reject incoming requests instead of sending a 100 Continue if you so desire.

Refactoring as per comments above was also performed.

Note: This patch changes the default behaviour in the case where both
the client and the server claim to support HTTP/1.1 from doing nothing
in the case of an "Expect: 100-continue" header on the request to
sending a 100 Continue response and then completing the request as normal.

--
keywords: +patch
nosy: +jerith
Added file: http://bugs.python.org/file10269/BaseHTTPServer_continue.patch

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1491>
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1491] BaseHTTPServer incorrectly implements response code 100

2008-05-10 Thread Jeremy Thurgood

Jeremy Thurgood <[EMAIL PROTECTED]> added the comment:

The above patch adds a set of tests for BaseHTTPServer, although the
only tests actually written were those around the areas touched by the
work done for this issue.

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1491>
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2746] ElementTree ProcessingInstruction uses character entities in content

2009-06-07 Thread Jeremy Thurgood

Changes by Jeremy Thurgood :


--
nosy: +jerith

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



[issue6230] ElementTree.Element and cElementTree.Element have slightly different repr

2009-06-07 Thread Jeremy Thurgood

Changes by Jeremy Thurgood :


--
nosy: +jerith

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



[issue6231] ElementInclude may drop text

2009-06-07 Thread Jeremy Thurgood

Changes by Jeremy Thurgood :


--
nosy: +jerith

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



[issue6232] Improve test coverage of ElementTree and cElementTree

2009-06-10 Thread Jeremy Thurgood

Changes by Jeremy Thurgood :


--
nosy: +jerith

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