Guido van Rossum
9f5c36fddb
Support loading of packages. (I had this coded up for a while but
...
didn't want to commit until it had been tested. I presume that it
works in Grail.)
1998-06-29 20:31:16 +00:00
Guido van Rossum
be0b62cab4
Added findall() to RegexObject -- return a list of all matches in a
...
string. Added groupdict() to MatchObject -- return the named groups
as a dict. Added default argument to groups() to specify what to
return for unmatching groups; groupdict() also has this.
1998-06-29 20:29:08 +00:00
Guido van Rossum
80884075f0
Improved by Eric Raymond.
1998-06-29 17:58:55 +00:00
Guido van Rossum
716b78474c
# Make tabnanny happy.
1998-06-29 17:58:43 +00:00
Guido van Rossum
3ad9dd559a
Improved by Eric Raymond.
1998-06-29 17:56:06 +00:00
Guido van Rossum
c94f16f156
Oops! Of course, Tim is right -- when the item is not a hex number,
...
the '%' should be put back in.
1998-06-29 00:42:54 +00:00
Guido van Rossum
52e86ad05b
Speed-up unquote(), inspired by post from Daniel Walton.
1998-06-28 23:49:35 +00:00
Guido van Rossum
1cd4d52f2f
Remove RCS and #! cruft at top.
1998-06-26 13:38:38 +00:00
Guido van Rossum
88b63b8d30
Allow binding a Tcl command (given as a string) as well as a Python
...
function.
1998-06-25 18:54:49 +00:00
Guido van Rossum
01852838f3
Treat "HEAD" same as "GET", so that CGI scripts won't fail.
1998-06-25 02:40:17 +00:00
Guido van Rossum
2349015a87
Rewrite the (test) main program so that when used as a script, it can
...
retrieve one or more URLs to stdout. Use -t to run the self-test.
1998-06-25 02:39:00 +00:00
Guido van Rossum
b1f0812be7
Piers' latest version, labeled 2.11. This time he integrated my
...
changes, and made only a few minor changes. No changes of my own this
time.
1998-06-25 02:22:16 +00:00
Guido van Rossum
95e6f7089a
Eric Raymond added support for ESMTP protocol and corrected some typos
...
in comments and doc strings.
1998-06-25 02:15:50 +00:00
Guido van Rossum
a93b848e33
Subsume the interact() function in a class. This should make it
...
possible to use this in PythonWin, and to replace Fredrik Lundh's
PythonInterpreter class. Fredrik is credited with the class' API.
1998-06-23 19:31:19 +00:00
Guido van Rossum
d9d2625dbd
"if match(x) >= 0:" smells of regex matching; should use "if match(x):"
1998-06-23 14:43:06 +00:00
Guido van Rossum
4d40b0a165
Patch by Eric Raymond: add an optional 'seekable' flag to the
...
MultiFile constructor, and only do the posstack bookkeeping when it is
true.
1998-06-23 14:20:27 +00:00
Guido van Rossum
5430b432e6
Bugfix to ESR's code reported by himself: should use hasattr() to test
...
for presence unread, not getattr()!
1998-06-22 15:46:26 +00:00
Guido van Rossum
cef4c844df
Turns out that 'winfo id' returns the id as a hex string, with 0x prefix.
...
The int() function (aliased to getint()) doesn't handle that, so we must
use self.tk.getint() again...
1998-06-19 04:35:45 +00:00
Guido van Rossum
268824e089
Different trick to get the _test() window to pop up.
1998-06-19 04:34:19 +00:00
Guido van Rossum
eda960a1dd
Piers' latest version -- authentication added by Donn Cave.
1998-06-18 14:24:28 +00:00
Guido van Rossum
e50b0a44cb
In class _Subfile, make sure read(n) can't read beyond EOF. Also
...
allow negative numbers to specify read until EOF (like for a regular
file's read() method).
1998-06-17 18:34:40 +00:00
Guido van Rossum
81d10b479e
Add __getitem__ to AddressList object, to make it a sequence.
1998-06-16 22:29:03 +00:00
Guido van Rossum
4d4ab9245f
Some extra comments and docstrings, and a new class (AddressList), all by ESR.
1998-06-16 22:27:09 +00:00
Guido van Rossum
32490824b6
Fixed the UDP server -- this never worked. Ray Loyzaga deserves
...
credit for complaining about this and for testing these changes.
1998-06-16 02:27:33 +00:00
Guido van Rossum
d458faadc3
In completer(), return None instead of raising an IndexError when
...
there are no more completions left. (This for compatibility with
Donald Beaudry's code.)
1998-06-12 19:42:14 +00:00
Guido van Rossum
c3da02e904
Don't catch interrupts in getpass() -- the finally clause will reset
...
the tty and the caller can deal with the interrupt.
In the windows version, recognize ^C and raise KeyboardInterrupt (not
sure if this is needed, but can't hurt).
1998-06-12 14:28:38 +00:00
Guido van Rossum
ae9ee7329d
Use the getpass module instead of having platform-specific echo on/off
...
code here.
1998-06-12 14:21:13 +00:00
Guido van Rossum
69256612d7
With the recent change that makes numbers compare smaller than anything,
...
the outcome of the test for max has changed.
1998-06-11 22:25:59 +00:00
Guido van Rossum
08636f08ed
Now that test_MimeWriter is untabified, do the same here!
1998-06-11 22:22:39 +00:00
Guido van Rossum
cff311aa37
Be more careful than the previous patch. The default content-type
...
should only be set to application/x-www-form-urlencoded when the
method is POST. E.g. for PUT, an empty default (defaulting to
text/plain later) makes more sense.
1998-06-11 14:06:59 +00:00
Guido van Rossum
e894fc0ea3
Support new overridable method, isheader() (ESR).
...
Also implement __setitem__(), more-or-less correctly (GvR).
1998-06-11 13:58:40 +00:00
Guido van Rossum
c7bb8577c7
Some changes suggested/provided by Eric Raymond:
...
- explain seekable
- when seekable==1, test fp.tell() and set it to 0 if that fails
- support overridable method iscomment(line) to weed out comments
- check for unread() method on file object before trying to seek
And one of my own:
- Add a get() method which behaves like a dictionary's get(); this is
actually implemented by giving getheader() an optional second argument
to specify the default, and aliasing get to getheader.
1998-06-10 21:31:01 +00:00
Guido van Rossum
1f40cd6314
Add the __doc__ string from the original module on copy_none().
1998-06-09 21:33:44 +00:00
Guido van Rossum
dd47ec98e2
Default content-type to application/x-www-form-urlencoded at the top
...
level of a form. This means that browsers that omit the content-type
header when sending a POST command aren't penalized so heavily.
1998-06-09 19:49:16 +00:00
Guido van Rossum
e614fb12a0
Changed runs of 8 spaces to tab -- to satisfy the tab nanny.
1998-06-09 19:20:12 +00:00
Guido van Rossum
068ad97330
Untabified -- to satisfy the tab nanny.
1998-06-09 19:19:40 +00:00
Guido van Rossum
5a43e1a90c
Get rid of tabnanny's last complaints.
1998-06-09 19:04:26 +00:00
Guido van Rossum
aa2a7a4ae6
From: "Tim Peters" <tim_one@msn.com>
...
The 1.5.1 tabnanny.py suffers an assert error if fed a script whose last
line is both indented and lacks a newline:
if 1:
print 'oh fudge' # no newline here:
The attached version repairs that.
1998-06-09 19:02:21 +00:00
Guido van Rossum
fe02efdbf4
getint() now raises ValueError, not TclError, on errors.
1998-06-09 02:37:45 +00:00
Guido van Rossum
3c46234e5e
Remove Emacs and #! cruft.
1998-05-29 18:22:53 +00:00
Guido van Rossum
d659693b5b
Improve the self-test code a bit: read a host from sys.argv[1] if set,
...
and list the host name when prompting for the password.
1998-05-29 18:08:48 +00:00
Guido van Rossum
cc20b76ad0
Add comments explaining thread unsafety of this code.
1998-05-29 17:51:59 +00:00
Guido van Rossum
d03e1197cb
Make gauss() semi-thread-safe. It can still give duplicate results,
...
but it can no longer raise an exception when called by several threads
simultaneously.
1998-05-29 17:51:31 +00:00
Guido van Rossum
b39e461b89
Two places where _time() should be used said time.time(), which
...
doesn't work of course.
1998-05-29 17:47:10 +00:00
Guido van Rossum
6884af706b
Piers Lauders' latest version, with some of my own changes reapplied.
...
Also replaced random()*32000 with randint(0, 31999).
1998-05-29 13:34:03 +00:00
Guido van Rossum
1ad00717fb
Patch by Lars Marius Garshol:
...
- Handle <? processing instructions >.
- Allow . and - in entity names.
Also fixed an oversight in the previous fix (in one place, [ \t\r\n]
was used instead of string.whitespace).
1998-05-28 22:48:53 +00:00
Jeremy Hylton
2b9d029308
add handler for JPython's org.python.core.PyStringMap object, which
...
walks and quacks like a dictionary.
1998-05-27 22:38:22 +00:00
Guido van Rossum
16653cb273
Add Tim's worst case scenario.
...
Revert to using whrandom so it will work with older versions of Python.
1998-05-26 15:05:12 +00:00
Guido van Rossum
7462942b69
Added some tests to make sure that long->int conversions near
...
sys.maxint and near -sys.maxint-1 work correctly.
1998-05-26 14:51:55 +00:00
Fred Drake
5b34ec1b14
Fixed spelling in comment: "RFC", not "RFX".
1998-05-22 18:18:08 +00:00
Guido van Rossum
e9387ea773
introduce a new platform-specific variable: os.linesep is the
...
platform's line separator. \n on Unix, \r\n on DOS, OS/2 and Windows,
\r on Macs.
1998-05-22 15:26:04 +00:00
Guido van Rossum
26fd98201f
Change the last 4-space indent into a 1-tab indent.
1998-05-22 15:05:36 +00:00
Guido van Rossum
7ef2a1de9b
Shouldn't use newdir.dir(), which no longer exists!
1998-05-22 14:11:57 +00:00
Fred Drake
c9132066e7
knownfiles: Add the default installation dirs for Apache
...
versions <= 1.2, >= 1.3.
1998-05-21 13:15:45 +00:00
Guido van Rossum
b26a1b4e2b
Use random instead of whrandom.
1998-05-20 17:05:52 +00:00
Guido van Rossum
33d7f1a76c
Add Interfaces to replace remaining needs for importing whrandom.
...
# XXX TO DO: make the distribution functions below into methods.
1998-05-20 16:28:24 +00:00
Guido van Rossum
0bd5433cf8
Get rid of nearly all clals to self._do -- turns out self.tk.call can
...
be used just as well, so this saves one Python call in many cases!
1998-05-19 21:18:13 +00:00
Fred Drake
4941341858
guess_extension(): Revise documentation string to be more clear. If not
...
inited, call init().
1998-05-19 15:15:59 +00:00
Guido van Rossum
5f4fb913a2
Test that "import sys.imp" fails as it should.
1998-05-19 15:09:42 +00:00
Fred Drake
5109ffd607
guess_extension(): New function. Performs a reverse mapping from MIME type
...
to filename extension.
1998-05-18 16:27:20 +00:00
Guido van Rossum
67133e25a2
Neatify the _timezones table and remove a misleading comment about
...
inaccuracies in mktime_tz().
1998-05-18 16:09:10 +00:00
Fred Drake
3130b7a2a9
Fixed typo in docstring: suffixes_map --> suffix_map.
1998-05-18 16:05:24 +00:00
Guido van Rossum
4658682205
Subject: bug fixes for imaplib.py
...
From: Piers Lauder <piers@staff.cs.usyd.edu.au>
To: Python List <python-list@cwi.nl>
Date: Mon, 18 May 1998 09:51:53 +1000
Following is a context diff for imaplib.py in the Python1.5.1 distribution.
It fixes 2 bugs. One to do with argument quoting, and the other to do with
caching of un-tagged responses. Apologies for its size.
1998-05-18 14:39:42 +00:00
Guido van Rossum
7beaad4e75
Add file extension .xml, mapping it to text/xml.
1998-05-18 14:25:08 +00:00
Jeremy Hylton
ee918cb487
Fix bug reported by Harri Pasanen: gzip + cPickle doesn't work. The
...
problem was a couple of bugs in the readline implementation.
1. Include the '\n' in the string returned by readline
2. Bug calculating new buffer size in _unread
Also remove unncessary import of StringIO
1998-05-13 21:49:58 +00:00
Guido van Rossum
01fc65d92f
From: conrad@cgl.ucsf.edu (Conrad Huang %CGL)
...
To: python-list@cwi.nl
Date: 13 May 98 18:33:11 GMT
I think I found a bug in CGIHTTPServer.py. (Does anyone care? :-)
I was trying to use it as the web server for uploading files.
Python CGI scripts (using the CGI module) that worked for other
servers (e.g., Netscape Enterprise server) hang when run from
CGIHTTPServer. The problem is that the content type parameters,
in particular the boundary parameter, were not passed through to
the CGI scripts, thus making the MIME parsing code choke.
My simple-minded fix is:
% diff CGIHTTPServer.py /usr/local/lib/python1.5/CGIHTTPServer.py
137,140c136
< if self.headers.typeheader is None:
< env['CONTENT_TYPE'] = self.headers.type
< else:
< env['CONTENT_TYPE'] = self.headers.typeheader
---
> env['CONTENT_TYPE'] = self.headers.type
Conrad
1998-05-13 20:13:24 +00:00
Guido van Rossum
b298a300dd
Reduce memory requirements.
1998-05-12 13:21:31 +00:00
Guido van Rossum
03e35c548f
Add a few doc strings.
1998-05-10 18:27:29 +00:00
Guido van Rossum
ea176b663e
benchmark for list.sort()
1998-05-10 18:20:05 +00:00
Guido van Rossum
b1b4f94527
Make Tim O'Malley's requested change: in FieldStorage.__init__(), when
...
method='GET', always get the query string from environ['QUERY_STRING']
or sys.argv[1] -- ignore an explicitly passed in fp.
1998-05-08 19:55:51 +00:00
Fred Drake
073b829021
When a file name is selected ("OK" button, <Return> in the filename entry),
...
and the "key" keyword parameter was used to invoke .go(), use the directory
of the selected file as the stored directory to return to when the same key
is used again. This is useful since the user may well entry at least part
of the path in the filename box instead of doing a lot of clicking around in
the listboxes.
1998-05-06 17:28:23 +00:00
Guido van Rossum
e7b6e396fc
New files from Thomas Gellekum
1998-05-06 15:14:36 +00:00
Guido van Rossum
d618c91f14
Added table of WSA error codes.
1998-05-06 13:48:04 +00:00
Guido van Rossum
e0c0da98d8
Patches to make the proxy code work again. (Why does that always break
...
as soon as I change things even just a little bit? :-) Even works
when accessing a password-protected page through the proxy. Prompted
by complaints from, and correct operation verified by, Nigel O'Brian.
1998-05-05 13:58:13 +00:00
Guido van Rossum
a986bb7e5c
Take out the check for AUTH-LOGIN or AUTH=LOGIN in login() -- some
...
servers support LOGIN but don't advertise it. If it's not supported
the protocol will respond NO. Approved by Piers Lauder.
1998-05-05 03:08:46 +00:00
Guido van Rossum
b485224d82
REMOVE samefile(), sameopenfile(), samestat() -- these cannot be made
...
to work reliably (at least I wouldn't know how).
1998-05-02 00:47:09 +00:00
Guido van Rossum
e365a590d4
Change the names of all methods in the Wm class: they are now
...
wm_title(), etc. The old names (title() etc.) are still defined as
aliases.
This brings all methods up to use the same naming convention: whether
the Tcl syntax is
.window.path.name command subcommand [options]
or
command subcommand .window.path.name [optins]
the Python equivalent is always
windowobject.command_subcommand(options)
1998-05-01 19:48:20 +00:00
Guido van Rossum
0132f69c2e
Another optimization, probably of negligeable effect: instead of
...
calling self.tk.getint() and self.tk.getdouble(), call the globals
getint() and getdouble(), which in turn are just names for the Python
builtins int() and double(). (Making them globals actually save a
dict lookup compared to using the built-in.) The corresponding
methods of class Misc have been changed similarly. (Note that
getboolean() hasn't been changed because there's no Python
equivalent.)
The use of int() and float() has another advantage: if/when Tcl calls
can actually return Tcl objects with other types than string, use of
int() and float() is essential.
1998-04-30 17:50:36 +00:00
Guido van Rossum
dc59340646
In _bind(), found a way to test for break without a temp variable.
1998-04-29 22:16:57 +00:00
Guido van Rossum
f975699c07
Save a tiny bit of time: self.tk.call takes a tuple argument so it's
...
not needed to say apply(self.tk.call, t); self.tk.call(t) has the same
effect. This cuts down tremendously on the number of apply() calls
made. No measurable effect, but at the very least it saves the lookup
of apply() in the globals!
1998-04-29 21:57:08 +00:00
Guido van Rossum
f0c891a2b2
Import MacOS at the top instead of insize Tk.__init__() -- the latter
...
repeats the I/O for the failed import on each interpreter creation.
1998-04-29 21:43:36 +00:00
Guido van Rossum
7e6d18c1c0
Replace all calls to acquire_lock() and release_lock() with acquire()
...
and release() instead.
1998-04-29 14:29:32 +00:00
Guido van Rossum
57a0661cb8
On the Mac, create the Temporary Items folder if it does not exist yet.
...
(Jack)
1998-04-28 16:03:34 +00:00
Guido van Rossum
9c93a69335
Put quotes around the filename, so spaces in filenames work.
...
(Jack)
1998-04-28 16:03:03 +00:00
Guido van Rossum
53117ae82a
typo in error message (fname vs. file).
...
(Jack)
1998-04-28 16:01:13 +00:00
Guido van Rossum
b86ba124ea
Support byte-swapped dbhash (bsddb) files. Found by Ben Sayer.
1998-04-28 15:41:03 +00:00
Guido van Rossum
fc1f64d90d
Oops, I had 'n' and 'c' mixed up in my mind. Get rid of the comment
...
that wonders what the difference is and explain them properly.
1998-04-28 15:23:09 +00:00
Guido van Rossum
a5c0998242
Inspired by Ben Sayer, rewritten the code and some of the comments to
...
be more intelligent when the database already exists (use the module
for the existing file, according to whichdb). Noted in the doc
strings that there doesn't seem to be a different between 'c' and 'n'.
1998-04-28 15:19:34 +00:00
Guido van Rossum
e86271af72
When setting the event structure fields, don't die when the widget
...
name is not registered; simply use the string. This happens for
tear-off widgets (e.g. if you've registered enter/leave events for the
menu).
1998-04-27 19:32:59 +00:00
Guido van Rossum
0eae8fba81
Feeble attempt at making urlopen more robust -- don't call splituser()
...
when splithost() returned no useable host, to avoid calling
splituser() on None.
1998-04-27 15:19:17 +00:00
Fred Drake
9291d271fb
parse150(): Simplify RE used to parse the message a little, taking advantage
...
of using re instead of regex.
1998-04-27 14:39:44 +00:00
Guido van Rossum
446898ff4a
Use hex() when outputting the various checksums so the test output is the
...
same on 32 and 64 bit machines.
1998-04-24 18:31:28 +00:00
Guido van Rossum
bb189dbcb0
Small corrections to comments that were cloned from aifc; moreover
...
the description of setparams() was wrong.
wave.py: Include the tag of an unknown format in the exception.
1998-04-23 21:40:02 +00:00
Guido van Rossum
1740b8d2f7
New test sample -- "Nobody expects the Spanish Inquisition!"
1998-04-23 21:37:22 +00:00
Guido van Rossum
e26132cf5e
Move unified findfile() into test_support.py
1998-04-23 20:13:30 +00:00
Guido van Rossum
5fd90684a9
Run the self-test (test.test_MimeWriter) when invoked as a script.
1998-04-23 13:34:57 +00:00
Guido van Rossum
2ad816f47e
Add test for MimeWriter module
1998-04-23 13:33:56 +00:00
Guido van Rossum
e87ed5f6d4
Add writelines() method to Compare class.
1998-04-23 13:33:21 +00:00
Guido van Rossum
9a34523e19
As Tim Peters points out, ``from string import *'' should not set re to None.
...
Also rename safe_env to _safe_env.
1998-04-20 14:01:00 +00:00
Fred Drake
de2f708299
Fix regexp for attrfind; bug reported by Lars Marius Garshol
...
<larsga@ifi.uio.no>.
1998-04-16 21:04:26 +00:00