[Python-checkins] CVS: python/dist/src/Lib imaplib.py,1.24,1.25
Eric S. Raymond
esr@users.sourceforge.net
Thu, 08 Feb 2001 22:50:23 -0800
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv11544
Modified Files:
imaplib.py
Log Message:
String method conversion.
Index: imaplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/imaplib.py,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -r1.24 -r1.25
*** imaplib.py 2001/01/24 04:16:09 1.24
--- imaplib.py 2001/02/09 06:50:21 1.25
***************
*** 14,21 ****
#
# Authentication code contributed by Donn Cave <donn@u.washington.edu> June 1998.
! __version__ = "2.39"
! import binascii, re, socket, string, time, random, sys
__all__ = ["IMAP4", "Internaldate2tuple",
--- 14,22 ----
#
# Authentication code contributed by Donn Cave <donn@u.washington.edu> June 1998.
+ # String method conversion by ESR, February 2001.
! __version__ = "2.40"
! import binascii, re, socket, time, random, sys
__all__ = ["IMAP4", "Internaldate2tuple",
***************
*** 168,172 ****
if not self.untagged_responses.has_key(cap):
raise self.error('no CAPABILITY response from server')
! self.capabilities = tuple(string.split(string.upper(self.untagged_responses[cap][-1])))
if __debug__:
--- 169,173 ----
if not self.untagged_responses.has_key(cap):
raise self.error('no CAPABILITY response from server')
! self.capabilities = tuple(self.untagged_responses[cap][-1].upper().split())
if __debug__:
***************
*** 186,190 ****
# Allow UPPERCASE variants of IMAP4 command methods.
if Commands.has_key(attr):
! return eval("self.%s" % string.lower(attr))
raise AttributeError("Unknown IMAP4 command: '%s'" % attr)
--- 187,191 ----
# Allow UPPERCASE variants of IMAP4 command methods.
if Commands.has_key(attr):
! return eval("self.%s" % attr.lower())
raise AttributeError("Unknown IMAP4 command: '%s'" % attr)
***************
*** 225,229 ****
(code, [data]) = <instance>.response(code)
"""
! return self._untagged_response(code, [None], string.upper(code))
--- 226,230 ----
(code, [data]) = <instance>.response(code)
"""
! return self._untagged_response(code, [None], code.upper())
***************
*** 279,283 ****
be sent instead.
"""
! mech = string.upper(mechanism)
cap = 'AUTH=%s' % mech
if not cap in self.capabilities:
--- 280,284 ----
be sent instead.
"""
! mech = mechanism.upper()
cap = 'AUTH=%s' % mech
if not cap in self.capabilities:
***************
*** 538,542 ****
Returns response appropriate to 'command'.
"""
! command = string.upper(command)
if not Commands.has_key(command):
raise self.error("Unknown IMAP4 UID command: %s" % command)
--- 539,543 ----
Returns response appropriate to 'command'.
"""
! command = command.upper()
if not Commands.has_key(command):
raise self.error("Unknown IMAP4 UID command: %s" % command)
***************
*** 730,734 ****
# Read literal direct from connection.
! size = string.atoi(self.mo.group('size'))
if __debug__:
if self.debug >= 4:
--- 731,735 ----
# Read literal direct from connection.
! size = int(self.mo.group('size'))
if __debug__:
if self.debug >= 4:
***************
*** 833,838 ****
def _quote(self, arg):
! arg = string.replace(arg, '\\', '\\\\')
! arg = string.replace(arg, '"', '\\"')
return '"%s"' % arg
--- 834,839 ----
def _quote(self, arg):
! arg = arg.replace('\\', '\\\\')
! arg = arg.replace('"', '\\"')
return '"%s"' % arg
***************
*** 921,925 ****
for name in ('day', 'year', 'hour', 'min', 'sec', 'zoneh', 'zonem'):
! exec "%s = string.atoi(mo.group('%s'))" % (name, name)
# INTERNALDATE timezone must be subtracted to get UT
--- 922,926 ----
for name in ('day', 'year', 'hour', 'min', 'sec', 'zoneh', 'zonem'):
! exec "%s = int(mo.group('%s'))" % (name, name)
# INTERNALDATE timezone must be subtracted to get UT
***************
*** 967,971 ****
return ()
! return tuple(string.split(mo.group('flags')))
--- 968,972 ----
return ()
! return tuple(mo.group('flags').split())
***************
*** 1011,1016 ****
if not l: return
t = '\n\t\t'
! j = string.join
! l = map(lambda x,j=j:'%s: "%s"' % (x[0], x[1][0] and j(x[1], '" "') or ''), l)
_mesg('untagged responses dump:%s%s' % (t, j(l, t)))
--- 1012,1016 ----
if not l: return
t = '\n\t\t'
! l = map(lambda x:'%s: "%s"' % (x[0], x[1][0] and '" "'.join(x[1]) or ''), l)
_mesg('untagged responses dump:%s%s' % (t, j(l, t)))
***************
*** 1049,1053 ****
USER = getpass.getuser()
! PASSWD = getpass.getpass("IMAP password for %s on %s" % (USER, host or "localhost"))
test_mesg = 'From: %s@localhost\nSubject: IMAP4 test\n\ndata...\n' % USER
--- 1049,1053 ----
USER = getpass.getuser()
! PASSWD = getpass.getpass("IMAP password for %s on %s:" % (USER, host or "localhost"))
test_mesg = 'From: %s@localhost\nSubject: IMAP4 test\n\ndata...\n' % USER
***************
*** 1094,1098 ****
mo = re.match(r'.*"([^"]+)"$', ml)
if mo: path = mo.group(1)
! else: path = string.split(ml)[-1]
run('delete', (path,))
--- 1094,1098 ----
mo = re.match(r'.*"([^"]+)"$', ml)
if mo: path = mo.group(1)
! else: path = ml.split()[-1]
run('delete', (path,))
***************
*** 1103,1107 ****
continue
! uid = string.split(dat[-1])
if not uid: continue
run('uid', ('FETCH', '%s' % uid[-1],
--- 1103,1107 ----
continue
! uid = dat[-1].split()
if not uid: continue
run('uid', ('FETCH', '%s' % uid[-1],