If you send something like "PUT / HTTP/1.0" to something derived from
BaseHTTPServer that doesn't define do_PUT, you will get a response
that begins like this:
HTTP/1.0 501 Unsupported method ('do_PUT')
Server: SimpleHTTP/0.3 Python/1.5
Date: Tue, 30 Mar 1999 18:53:53 GMT
The server should complain about 'PUT' instead of 'do_PUT'. This
patch should fix the problem.
"""
- It needlessly used the makefile() method for each response that is
read from the SMTP server.
- If the remote SMTP server closes the connection unexpectedly the
code raised an IndexError. It now raises an SMTPServerDisconnected
exception instead.
- The code now checks that all lines in a multiline response actually
contains an error code.
"""
The Dragon approves.
allow using the 'a' flag as a mode for opening a GzipFile. gzip
files, surprisingly enough, can be concatenated and then decompressed;
the effect is to concatenate the two chunks of data.
If we support it on writing, it should also be supported on reading.
This *wasn't* trivial, and required rearranging the code in the
reading path, particularly the _read() method.
Raise IOError instead of RuntimeError in two cases, 'Not a gzipped file'
and 'Unknown compression method'
If a filename on Windows starts with \\, it is converted to a URL
which starts with ////. If this URL is passed to urlparse.urlparse
you get a path that starts with // (and an empty netloc). If you pass
the result back to urlparse.urlunparse, you get a URL that starts with
//, which is parsed differently by urlparse.urlparse. The fix is to
add the (empty) netloc with accompanying slashes if the path in
urlunparse starts with //. Do this for all schemes that use a netloc.
Pathnames of files on other hosts in the same domain
(\\host\path\to\file) are not translated correctly to URLs and back.
The URL should be something like file:////host/path/to/file.
Note that a combination of drive letter and remote host is not
possible.
netloc from the base url as the default netloc for the resulting url
even if the schemes differ.
Once upon a time, when the web was wild, this was a valuable hack
because some people had a URL referencing an ftp server colocated with
an http server without having the host in the ftp URL (so they could
replicate it or change the hostname easily).
More recently, after the file: scheme got added back to the list of
schemes that accept a netloc, it turns out that this caused weirdness
when joining an http: URL with a file: URL -- the resulting file: URL
would always inherit the host from the http: URL because the file:
scheme supports a netloc but in practice never has one.
There are two reasons to get rid of the old, once-valuable hack,
instead of removing the file: scheme from the uses_netloc list. One,
the RFC says that file: uses the netloc syntax, and does not endorse
the old hack. Two, neither netscape 4.5 nor IE 4.0 support the old
hack.
An attempt to execute grid_slaves with arguments (0,0) results in
*all* of the slaves being returned, not just the slave associated with
row 0, column 0. This is because the test for arguments in the method
does not test to see if row (and column) does not equal None, but
rather just whether is evaluates to non-false. A value of 0 fails
this test.
The module cmd requires for each do_xxx command a help_xxx
function. I think this is a little old fashioned.
Here is a patch: use the docstring as help if no help_xxx
function can be found.
[I'm tempted to rip out all the help_* functions from pdb, but I'll
resist it. Any takers? --Guido]
urlopen is used to specify form data, make sure the second argument is
threaded through all of the http_error_NNN calls. This allows error
handlers like the redirect and authorization handlers to properly
re-start the connection.
o the initial comment is wrong: creating messages is already
implemented
o Message.getbodytext: if the mail or it's part contains an
empty content-transfer-encoding header, the code used to
break; the change below treats an empty encoding value the same
as the other types that do not need decoding
o SubMessage.getbodytext was missing the decode argument; the
change below adds it; I also made it unconditionally return
the raw text if decoding was not desired, because my own
routines needed that (and it was easier than rewriting my
own routines ;-)
+ Implements a put_nowait method.
+ Adds a corresponding Queue.Full exception.
+ Simplifies the implementation by adding optional "block" args to get() and
put(), and makes the old get_nowait() and new put_nowait() one-line
redirections to get() and put().
+ Uses (much) simpler logic for the nowait cases.
+ Regularizes the doc strings to something closer to "Guido style" <wink>.
+ Converts two stray tabs into spaces.
+ Removes confusing verbiage about the queue "not being available" from the
docstrings -- never knew what that meant as a user, and after digging into
the implementation still didn't know what it was trying to say.
Also finally get rid of some obsolete commented-out access statements.
A note about the previous checkin: I believe it's correct, but I found
something strange: the file Lib/test/audiotest.au in the Python
distribution was evidently encoded in u-LAW format but had its
encoding set to 2, i.e. linear-8. I hope that this is a mistake
caused by some conversion program that produced this .au file; I just
found it on a website.
Fix leaking of instances by removing the elements variable that we
created on closing the parser. The elements variable is now created
in the reset() method, so that the sequence close(); reset();
... works.
Also, add the name of the entity reference that wasn't found to the
error message.
from Python 1.5.1:
If after __init__ finishes no new elements variable was created, this
patch will search the instance's namespace for all attributes whose
name start with start_ or end_ and put their value in a new elements
instance variable.
In the docstring of ConfigParser.py (Python 1.5.2b1):
read(*filenames) -- read and parse the list of named configuration files
should be:
read(filenames) -- read and parse the list of named configuration files
The method accepts a list, not a bunch of positional arguments.
Which is good, the list is much more convenient.
applied to all filenames before they are compared, looked up in the
breaks dictionary, etc. The default implementation does nothing --
it's implented as fast as possible via str(). A useful implementation
would make everything a absolute, e.g. return os.path.normcase(
os.path.abspath(filename)).
module myself) to accept an option keyword argument (vars) that is
substituted on top of the defaults that were setup in __init__. The
patch also fixes the problem where you can't have recusive references
inside your configuration file.
clear
clear file:line
clear bpno bpno ...
Also print the breakpoint data after calling set_break(), because the
print statement in set_break() has gone.
Add new clear_bpbynumber() with single bpno argument. (Adapted from
a patch by Richard Wolff.)
Also some cleanup in error messages and moved some comments into a
docstring.
named header, so that if a message has, e.g. multiple CC: lines, all
will get returned by the call to getaddrlist(). It also correctly
handles addresses which show up in continuation lines.
AdderlistClass.__init__(): Added \n to self.CR which fixes a bug that
sometimes, an address would contain a bogus trailing newline.
Message.getaddress(): In final else clause, added a test for the
character we're at being in self.specials. Without this, such
characters never get consumed and we infloop. Case in point (as
posted to c.l.py):
To: <[smtp:dd47@mail.xxx.edu]_at_hmhq@hdq-mdm1-imgout.companay.com>
----------------------------^
otherwise we'd infloop here
text/plain for inner parts, but application/x-www-form-urlencoded
for outer parts. Honor any existing content-type header.
Lower down, if the content-type header is something we don't
understand (say because it there was a typo in the header coming from
the client), default to text/plain for inner parts, but
application/x-www-form-urlencoded for outer parts.
in autoexec.bat in order to find the Tcl DLLs -- Tkinter calls FixTk
which will hunt around in a few common places and then set PATH
and try again, or else issue a big clarifying error message.
Extended the rfc822 parsedate routines to handle the cases they failed
on in an archive of ~37,000 messages. I believe the changes are
compatible, in that all previously correct parsing are still correct.
[I still see problems with some messages, but no showstoppers.]
# Message to all python-checkins readers: we have a problem with the
# CVS mirroring software. You can't check out the latest changes yet.
# We hope to have fixed this by noon EST today.
"""
The message ID is returned lowercased and there is no way to access
the original ID the server sent. Now at least some news servers
are very picky about the case of the ID and return errors when
fetching articles with mixed case given a lowercased version
of the ID.
The solution is simple: remove the string.lower() call.
"""
(I might add that the lowercasing was probably introduced as a result
of sloppy copy-and-paste coding; there's a string.lower in a similar
piece of code a bit higher in the source, that makes more sense --
it's lowercasing the group name.)
yours, please let me know for propoer acknowledgement.)
This avoids recompiling files that haven't changed; it adds a -f
option to force recompilation.
- Fixed a bug where a syntax error was reported when a document
started with white space. (White space at the start of a document
is valid if there is no XML declaration.)
- Improved the speed quite a bit for documents that don't make use of
namespaces.
Here is my current version of xmllib.py and the documentation. This
version has some API changes with respect to the version currently in
Python (also the one in 1.5.2a).
This version supports XML namespaces.
File names with "funny" characters get translated wrong by
pathname2url (any variety). E.g. the (Unix) file "/ufs/sjoerd/#tmp"
gets translated into "/ufs/sjoerd/#tmp" which, when interpreted as a
URL is file "/ufs/sjoerd/" with fragment ID "tmp".
Here's an easy fix. (An alternative fix would be to change the
various implementations of pathname2url and url2pathname to include
calls to quote and unquote.
[The main problem is with the normal use of URLs:
url = url2pathname(file)
transmit url
url, tag = splittag(url)
urlopen(url)
]
In addition, this patch fixes some uses of unquote:
- the host part of URLs should be unquoted
- the file path in the FTP URL should be unquoted before it is split
into components.
- because of the latter, I removed all unquoting from ftpwrapper,
and moved it to the caller, but that is not essential
when we create a recursive instance, by setting the class variable
'FieldStorageClass' to the desired class. By default, this is set to
None, in which case we use self.__class__ (as before).