]> granicus.if.org Git - python/commitdiff
Improve the self-test code a bit: read a host from sys.argv[1] if set,
authorGuido van Rossum <guido@python.org>
Fri, 29 May 1998 18:08:48 +0000 (18:08 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 29 May 1998 18:08:48 +0000 (18:08 +0000)
and list the host name when prompting for the password.

Lib/imaplib.py

index e62764452ed8f631392d46bb68a1128b52334995..caea5bfc582fe0ad416b694378114c22cf505da0 100644 (file)
@@ -781,9 +781,15 @@ def Time2Internaldate(date_time):
 
 if __debug__ and __name__ == '__main__':
 
+       host = ''
+       import sys
+       if sys.argv[1:]:
+               host = sys.argv[1]
+
        import getpass
        USER = getpass.getuser()
-       PASSWD = getpass.getpass()
+       PASSWD = getpass.getpass(
+               "IMAP password for %s: " % (host or "localhost"))
 
        test_seq1 = (
        ('login', (USER, PASSWD)),
@@ -815,7 +821,7 @@ if __debug__ and __name__ == '__main__':
                return dat
 
        Debug = 4
-       M = IMAP4()
+       M = IMAP4(host)
        print 'PROTOCOL_VERSION = %s' % M.PROTOCOL_VERSION
 
        for cmd,args in test_seq1: