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).
When literal mode is entered it should exit automatically when the
matching close tag of the last unclosed open tag is encountered. This
patch fixes this.
In SimpleHTTPServer.py, the server specified in test() should
be BaseHTTPServer.HTTPServer, in case the request handler should
want to reference the two attributes added by
BaseHTTPServer.server_bind:
self.server_name = hostname
self.server_port = port
There was some Bobo CGI code that wanted access to those attributes.
In CGIHTTPServer.py, the list of acceptable formats is -split-
on spaces but -joined- on commas, resulting in double commas
in the joined text. It appears harmless to my browser but
ought to be fixed anyway.
'A, B, C' -> 'A,', 'B,', 'C,' -> 'A,,B,,C'
Because it might be a common mistake to pass a single string, this
situation is treated separately.
Since we were making a copy of the longopts list anyway, we now use
the list() function -- this made it necessary to change all uses of
the local variable (and argument) 'list' to something more meaningful,
i.e., 'opts'.
Also added docstrings (copied from the library manual) and removed the
(now redundant) module comments.
filenames generated are easily predictable, it is possible to trick an
unsuspecting program into overwriting another file by creating a
symbolic link with the predicted name. Fix this by using the
low-level os.open() function with the O_EXCL flag and mode 0700. On
non-Unix platforms, presumably there are no symbolic links so the
problem doesn't exist. The explicit test for Unix (posix, actually)
makes it possible to change the non-Unix logic to work without a
try-except clause.
The mktemp() file is as unsafe as ever.
"""
I've attached a long overdue patch to pickle.py to bring it to format
1.3, which is the same as 1.2 except that the binary float format
is supported. This is done using the new platform-indepent format
features of struct.
This patch also gets rid of the undocumented obsolete Pickler
dump_special method.
"""
"""
Jochen Hayek has reported a problem with some versions of IMAP4
servers that choose to mix the case in their CAPABILITIES response.
The patch below fixes the problem.
"""
"""
The FieldStorage constructor calls the read_multi method. The read_multi
method creates new FieldStorage objects, re-invoking the constructor
(on the new objects). The problem is that the 'environ', 'keep_blank_values',
and 'strict_parsing' arguments originally passed to the constructor are not
propigated to the new object constructors. This causes os.environ to be used,
leading to a miss-handling of the parts.
I fixed this by passing these arguments to read_multi and then on to the
constructor. See the context diff below.
"""
assign the exception info to sys.last_{type,value,traceback}. That
way, an introspective Tkinter app can inspect its own stack trace.
(The controversy is that it would keep some objects alive, but that's
probably no big deal.)
Fix bug in NoDefaultRoot() -- _default_root wasn't declared global;
and made it reentrant.
Don't set _default_root to whatever master gets passed in to
BaseWidget._setup() (only set it when we need to create a new Tk()
widget).
there's a syntax error. (In particular, display the correct
filename). This changes the API: if there's a syntax error, the
function now returns normally after dumping the error to sys.stderr.
I changed Sjoerd's use of string.join(string.split(...)) with
string.replace().
Added a debug function to replace 'print' statements.
Ensured that response attached to 'NO' replies is passed back.
added readonly exception.
Rearranged method order into types.
Ensure select returns a meaningful error on 'NO'.
'NO' returns from authenticate and login raise error with last message,
not list.
1. Generate a correct Content-Length header visible through the info() method
if a request to open an FTP URL gets a length in the response to RETR.
2. Take a third argument to urlretrieve() that makes it possible to progress-
meter an urlretrieve call (this is what I needed the above change for).
See the second patch band below for details.
3. To avoid spurious errors, I commented out the gopher test. The target
document no longer exists.
InteractiveInterpreter, which handles parsing and interpreter state
but doesn't know deal with buffering or prompting or input file
naming. And a derived class, InteractiveConsole, which adds buffering
and prompting and supports setting the filename once. Also tweak the
algorithm in compile_command() a bit so that input consisting of all
blank lines or comments always succeeds immediately, and note the fact
that apart from SyntaxError it can also raise OverflowError.
Windows. If sys.stdin doesn't appear to be a real file (characterized
by having a working fileno()), don't use any console specific methods
-- go straight to the default.
function is only used when running the calibration code, and it turns
out that recent changes in the timing code caused this statement to
raise an exception.
there's an __getinitargs__() method), if a TypeError occurs, catch and
reraise it but add info to the error about the class name being
instantiated. This makes debugging a lot easier if __getinitargs__()
returns something bogus (e.g. a string instead of a singleton tuple).