[Python-checkins] CVS: python/dist/src/Lib imaplib.py,1.20,1.21

Fred L. Drake python-dev@python.org
Wed, 24 May 2000 20:25:28 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory slayer.i.sourceforge.net:/tmp/cvs-serv30011

Modified Files:
	imaplib.py 
Log Message:

Piers Lauder <piers@cs.su.oz.au>:
This patch adds a comment about quoting to the doc string,
and also checks that the 'flags' argument to the STORE command
is appropriately enclosed inside parentheses to avoid quoting.



Index: imaplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/imaplib.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -r1.20 -r1.21
*** imaplib.py	2000/03/28 21:45:46	1.20
--- imaplib.py	2000/05/25 03:25:26	1.21
***************
*** 16,20 ****
  # Authentication code contributed by Donn Cave <donn@u.washington.edu> June 1998.
  
! __version__ = "2.36"
  
  import binascii, re, socket, string, time, random, sys
--- 16,20 ----
  # Authentication code contributed by Donn Cave <donn@u.washington.edu> June 1998.
  
! __version__ = "2.39"
  
  import binascii, re, socket, string, time, random, sys
***************
*** 88,95 ****
  	All arguments to commands are converted to strings, except for
  	AUTHENTICATE, and the last argument to APPEND which is passed as
! 	an IMAP4 literal.  If necessary (the string contains
! 	white-space and isn't enclosed with either parentheses or
! 	double quotes) each string is quoted. However, the 'password'
! 	argument to the LOGIN command is always quoted.
  
  	Each command returns a tuple: (type, [data, ...]) where 'type'
--- 88,98 ----
  	All arguments to commands are converted to strings, except for
  	AUTHENTICATE, and the last argument to APPEND which is passed as
! 	an IMAP4 literal.  If necessary (the string contains any
! 	non-printing characters or white-space and isn't enclosed with
! 	either parentheses or double quotes) each string is quoted.
! 	However, the 'password' argument to the LOGIN command is always
! 	quoted.  If you want to avoid having an argument string quoted
! 	(eg: the 'flags' argument to STORE) then enclose the string in
! 	parentheses (eg: "(\Deleted)").
  
  	Each command returns a tuple: (type, [data, ...]) where 'type'
***************
*** 352,355 ****
--- 355,361 ----
  		(typ, [data, ...]) = <instance>.fetch(message_set, message_parts)
  
+ 		'message_parts' should be a string of selected parts
+ 		enclosed in parentheses, eg: "(UID BODY[TEXT])".
+ 
  		'data' are tuples of message part envelope and data.
  		"""
***************
*** 503,512 ****
  
  
! 	def store(self, message_set, command, flag_list):
  		"""Alters flag dispositions for messages in mailbox.
  
! 		(typ, [data]) = <instance>.store(message_set, command, flag_list)
  		"""
! 		typ, dat = self._simple_command('STORE', message_set, command, flag_list)
  		return self._untagged_response(typ, dat, 'FETCH')
  
--- 509,520 ----
  
  
! 	def store(self, message_set, command, flags):
  		"""Alters flag dispositions for messages in mailbox.
  
! 		(typ, [data]) = <instance>.store(message_set, command, flags)
  		"""
! 		if (flags[0],flags[-1]) != ('(',')'):
! 			flags = '(%s)' % flags	# Avoid quoting the flags
! 		typ, dat = self._simple_command('STORE', message_set, command, flags)
  		return self._untagged_response(typ, dat, 'FETCH')