summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-05-29 18:08:48 (GMT)
committerGuido van Rossum <guido@python.org>1998-05-29 18:08:48 (GMT)
commitd659693b5b44ca8a8fa00945514ce9895132a0b3 (patch)
tree74f9639faaf1cb6638d09ec4aaf3c52e71c5d724
parenta119c0dd5e90796a5acacfcbbca1c2ddd41eba1b (diff)
downloadcpython-d659693b5b44ca8a8fa00945514ce9895132a0b3.zip
cpython-d659693b5b44ca8a8fa00945514ce9895132a0b3.tar.gz
cpython-d659693b5b44ca8a8fa00945514ce9895132a0b3.tar.bz2
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.
-rw-r--r--Lib/imaplib.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/imaplib.py b/Lib/imaplib.py
index e627644..caea5bf 100644
--- a/Lib/imaplib.py
+++ b/Lib/imaplib.py
@@ -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: