]> granicus.if.org Git - python/commitdiff
added a few more __all__ lists
authorSkip Montanaro <skip@pobox.com>
Thu, 25 Jan 2001 15:29:22 +0000 (15:29 +0000)
committerSkip Montanaro <skip@pobox.com>
Thu, 25 Jan 2001 15:29:22 +0000 (15:29 +0000)
test___all__.py: fail silently in check_all if the module can't be imported

Lib/mimetools.py
Lib/mimetypes.py
Lib/mimify.py
Lib/test/test___all__.py

index bb8a29934e7141b9eceb92ae62b7998504461803..81913bdf3d7c1898b8d1b2f7d3a05407b1725983 100644 (file)
@@ -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
index 9dc3645fd0d141b52c16ab8cb64c91640fe5540a..444184bc4b10fa62d950afbd8baacec7dbb6a2dc 100644 (file)
@@ -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",
index 34b0206c28a768270877adb410ce0dee1058d92e..cb86c9eb77bf8a4049a6515253cb5c54ddcaf234 100755 (executable)
@@ -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)
index 079f98c81177a74c53facda79e97e8c86496c7fe..f11a0c706abfdc6ad8d980352202b5d8dd9578ed 100644 (file)
@@ -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")