diff options
author | Skip Montanaro <skip@pobox.com> | 2001-01-25 15:29:22 (GMT) |
---|---|---|
committer | Skip Montanaro <skip@pobox.com> | 2001-01-25 15:29:22 (GMT) |
commit | 03d90149920274b58f6ab121caae81ae9c424946 (patch) | |
tree | 8bea349ad17369f28f22d176b5a6e0fedc7c2542 /Lib | |
parent | 438bb947893e92455decfaadd739034fe26e192a (diff) | |
download | cpython-03d90149920274b58f6ab121caae81ae9c424946.zip cpython-03d90149920274b58f6ab121caae81ae9c424946.tar.gz cpython-03d90149920274b58f6ab121caae81ae9c424946.tar.bz2 |
added a few more __all__ lists
test___all__.py: fail silently in check_all if the module can't be imported
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/mimetools.py | 2 | ||||
-rw-r--r-- | Lib/mimetypes.py | 2 | ||||
-rwxr-xr-x | Lib/mimify.py | 2 | ||||
-rw-r--r-- | Lib/test/test___all__.py | 18 |
4 files changed, 16 insertions, 8 deletions
diff --git a/Lib/mimetools.py b/Lib/mimetools.py index bb8a299..81913bd 100644 --- a/Lib/mimetools.py +++ b/Lib/mimetools.py @@ -5,6 +5,8 @@ import os import rfc822 import tempfile +__all__ = ["Message","choose_boundary","encode","decode","copyliteral", + "copybinary"] class Message(rfc822.Message): """A derived class of rfc822.Message that knows about MIME headers and diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py index 9dc3645..444184b 100644 --- a/Lib/mimetypes.py +++ b/Lib/mimetypes.py @@ -27,6 +27,8 @@ import string import posixpath import urllib +__all__ = ["guess_type","guess_extension","read_mime_types","init"] + knownfiles = [ "/usr/local/etc/httpd/conf/mime.types", "/usr/local/lib/netscape/mime.types", diff --git a/Lib/mimify.py b/Lib/mimify.py index 34b0206..cb86c9e 100755 --- a/Lib/mimify.py +++ b/Lib/mimify.py @@ -29,6 +29,8 @@ QUOTE = '> ' # string replies are quoted with import re, string +__all__ = ["mimify","unmimify","mime_encode_header","mime_decode_header"] + qp = re.compile('^content-transfer-encoding:\\s*quoted-printable', re.I) base64_re = re.compile('^content-transfer-encoding:\\s*base64', re.I) mp = re.compile('^content-type:.*multipart/.*boundary="?([^;"\n]*)', re.I|re.S) diff --git a/Lib/test/test___all__.py b/Lib/test/test___all__.py index 079f98c..f11a0c7 100644 --- a/Lib/test/test___all__.py +++ b/Lib/test/test___all__.py @@ -3,7 +3,12 @@ import sys def check_all(modname): names = {} - exec "import %s" % modname in names + try: + exec "import %s" % modname in names + except ImportError: + # silent fail here seems the best route since some modules + # may not be available in all environments + return verify(hasattr(sys.modules[modname], "__all__"), "%s has no __all__ attribute" % modname) names = {} @@ -48,13 +53,7 @@ check_all("commands") check_all("compileall") check_all("copy") check_all("copy_reg") -try: - import bsddb -except ImportError: - if verbose: - print "can't import bsddb, so skipping dbhash" -else: - check_all("dbhash") +check_all("dbhash") check_all("dircache") check_all("dis") check_all("doctest") @@ -85,4 +84,7 @@ check_all("macpath") check_all("macurl2path") check_all("mailbox") check_all("mhlib") +check_all("mimetools") +check_all("mimetypes") +check_all("mimify") check_all("robotparser") |