[Python-checkins] r57771 - python/trunk/Lib/httplib.py python/trunk/Lib/imaplib.py python/trunk/Lib/poplib.py python/trunk/Lib/smtplib.py

thomas.wouters python-checkins at python.org
Thu Aug 30 23:54:39 CEST 2007


Author: thomas.wouters
Date: Thu Aug 30 23:54:39 2007
New Revision: 57771

Modified:
   python/trunk/Lib/httplib.py
   python/trunk/Lib/imaplib.py
   python/trunk/Lib/poplib.py
   python/trunk/Lib/smtplib.py
Log:

Don't lie in __all__ attributes when SSL is not available: only add the SSL
classes when they are actually created.



Modified: python/trunk/Lib/httplib.py
==============================================================================
--- python/trunk/Lib/httplib.py	(original)
+++ python/trunk/Lib/httplib.py	Thu Aug 30 23:54:39 2007
@@ -76,7 +76,7 @@
 except ImportError:
     from StringIO import StringIO
 
-__all__ = ["HTTP", "HTTPResponse", "HTTPConnection", "HTTPSConnection",
+__all__ = ["HTTP", "HTTPResponse", "HTTPConnection",
            "HTTPException", "NotConnected", "UnknownProtocol",
            "UnknownTransferEncoding", "UnimplementedFileMode",
            "IncompleteRead", "InvalidURL", "ImproperConnectionState",
@@ -1052,6 +1052,7 @@
             sock = socket.create_connection((self.host, self.port), self.timeout)
             self.sock = ssl.sslsocket(sock, self.key_file, self.cert_file)
 
+    __all__.append("HTTPSConnection")
 
     class HTTPS(HTTP):
         """Compatibility with 1.5 httplib interface

Modified: python/trunk/Lib/imaplib.py
==============================================================================
--- python/trunk/Lib/imaplib.py	(original)
+++ python/trunk/Lib/imaplib.py	Thu Aug 30 23:54:39 2007
@@ -24,7 +24,7 @@
 
 import binascii, os, random, re, socket, sys, time
 
-__all__ = ["IMAP4", "IMAP4_SSL", "IMAP4_stream", "Internaldate2tuple",
+__all__ = ["IMAP4", "IMAP4_stream", "Internaldate2tuple",
            "Int2AP", "ParseFlags", "Time2Internaldate"]
 
 #       Globals
@@ -1205,6 +1205,7 @@
             """
             return self.sslobj
 
+    __all__.append("IMAP4_SSL")
 
 
 class IMAP4_stream(IMAP4):

Modified: python/trunk/Lib/poplib.py
==============================================================================
--- python/trunk/Lib/poplib.py	(original)
+++ python/trunk/Lib/poplib.py	Thu Aug 30 23:54:39 2007
@@ -15,7 +15,7 @@
 
 import re, socket
 
-__all__ = ["POP3","error_proto","POP3_SSL"]
+__all__ = ["POP3","error_proto"]
 
 # Exception raised when an error or invalid response is received:
 
@@ -397,6 +397,7 @@
             del self.sslobj, self.sock
             return resp
 
+    __all__.append("POP3_SSL")
 
 if __name__ == "__main__":
     import sys

Modified: python/trunk/Lib/smtplib.py
==============================================================================
--- python/trunk/Lib/smtplib.py	(original)
+++ python/trunk/Lib/smtplib.py	Thu Aug 30 23:54:39 2007
@@ -52,7 +52,7 @@
 __all__ = ["SMTPException","SMTPServerDisconnected","SMTPResponseException",
            "SMTPSenderRefused","SMTPRecipientsRefused","SMTPDataError",
            "SMTPConnectError","SMTPHeloError","SMTPAuthenticationError",
-           "quoteaddr","quotedata","SMTP","SMTP_SSL"]
+           "quoteaddr","quotedata","SMTP"]
 
 SMTP_PORT = 25
 SMTP_SSL_PORT = 465
@@ -725,6 +725,8 @@
             self.sock = SSLFakeSocket(self.sock, sslobj)
             self.file = SSLFakeFile(sslobj)
 
+    __all__.append("SMTP_SSL")
+
 #
 # LMTP extension
 #


More information about the Python-checkins mailing list