summaryrefslogtreecommitdiffstats
path: root/Lib/imaplib.py
diff options
context:
space:
mode:
authorPiers Lauder <piers@cs.su.oz.au>2002-06-05 22:31:57 (GMT)
committerPiers Lauder <piers@cs.su.oz.au>2002-06-05 22:31:57 (GMT)
commitf97b2d7dad06e48e3bc255f16329fda1dc966da4 (patch)
treec789fc60106e084970b70416a40d17c6703f1c34 /Lib/imaplib.py
parent48165d40cbe4280ba4c668798200548a22bce3dd (diff)
downloadcpython-f97b2d7dad06e48e3bc255f16329fda1dc966da4.zip
cpython-f97b2d7dad06e48e3bc255f16329fda1dc966da4.tar.gz
cpython-f97b2d7dad06e48e3bc255f16329fda1dc966da4.tar.bz2
open method changed to use arguments and set instance host/port values (instead of __init__)
Diffstat (limited to 'Lib/imaplib.py')
-rw-r--r--Lib/imaplib.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/Lib/imaplib.py b/Lib/imaplib.py
index 77bfe9f..455ba9c 100644
--- a/Lib/imaplib.py
+++ b/Lib/imaplib.py
@@ -133,8 +133,6 @@ class IMAP4:
mustquote = re.compile(r"[^\w!#$%&'*+,.:;<=>?^`|~-]")
def __init__(self, host = '', port = IMAP4_PORT):
- self.host = host
- self.port = port
self.debug = Debug
self.state = 'LOGOUT'
self.literal = None # A literal argument to a command
@@ -205,13 +203,16 @@ class IMAP4:
# Overridable methods
- def open(self, host, port):
- """Setup connection to remote server on "host:port".
+ def open(self, host = '', port = IMAP4_PORT):
+ """Setup connection to remote server on "host:port"
+ (default: localhost:standard IMAP4 port).
This connection will be used by the routines:
read, readline, send, shutdown.
"""
+ self.host = host
+ self.port = port
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- self.sock.connect((self.host, self.port))
+ self.sock.connect((host, port))
self.file = self.sock.makefile('rb')
@@ -1005,14 +1006,17 @@ class IMAP4_SSL(IMAP4):
IMAP4.__init__(self, host, port)
- def open(self, host, port):
+ def open(self, host = '', port = IMAP4_SSL_PORT):
"""Setup connection to remote server on "host:port".
+ (default: localhost:standard IMAP4 SSL port).
This connection will be used by the routines:
read, readline, send, shutdown.
"""
+ self.host = host
+ self.port = port
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- self.sock.connect((self.host, self.port))
- self.sslobj = socket.ssl(self.sock,self.keyfile, self.certfile)
+ self.sock.connect((host, port))
+ self.sslobj = socket.ssl(self.sock, self.keyfile, self.certfile)
def read(self, size):