[Patches] imaplib.py patch

Piers Lauder piers@cs.su.oz.au
Wed, 24 May 2000 12:32:07 +1000


--127.0.0.1.126.20765.959136629.594.25884
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi!

Reason for patch:

	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.
	
	Here is the resulting "diff -c" patch against the version in the CVS
	tree as of 1/2 hour ago.

Standard disclaimer:

	I confirm that, to the best of my knowledge and belief, this contribution
	is free of any claims of third parties under copyright, patent or
	other rights or interests ("claims").  To the extent that I have
	any such claims, I hereby grant to CNRI a nonexclusive, irrevocable,
	royalty-free, worldwide license to reproduce, distribute, perform and/or
	display publicly, prepare derivative versions, and otherwise use this
	contribution as part of the Python software and its related documentation,
	or any derivative versions thereof, at no cost to CNRI or its licensed
	users, and to authorize others to do so.
	
	I acknowledge that CNRI may, at its sole discretion, decide whether
	or not to incorporate this contribution in the Python software and its
	related documentation.  I further grant CNRI permission to use my name
	and other identifying information provided to CNRI by me for use in
	connection with the Python software and its related documentation.

Piers Lauder.



--127.0.0.1.126.20765.959136629.594.25884
Content-Type: application/octet-stream; name=imaplib.diffs
Content-Transfer-Encoding: 7bit

*** python/dist/src/Lib/imaplib.py	Mon May 22 16:49:59 2000
--- piers/lib/html/python/imaplib.py	Wed May 24 12:47:46 2000
***************
*** 15,21 ****
  # 
  # Authentication code contributed by Donn Cave <donn@u.washington.edu> June 1998.
  
! __version__ = "2.36"
  
  import binascii, re, socket, string, time, random, sys
  
--- 15,21 ----
  # 
  # Authentication code contributed by Donn Cave <donn@u.washington.edu> June 1998.
  
! __version__ = "2.39"
  
  import binascii, re, socket, string, time, random, sys
  
***************
*** 87,96 ****
  
  	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'
  	is usually 'OK' or 'NO', and 'data' is either the text from the
--- 87,99 ----
  
  	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'
  	is usually 'OK' or 'NO', and 'data' is either the text from the
***************
*** 351,356 ****
--- 354,362 ----
  
  		(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.
  		"""
  		name = 'FETCH'
***************
*** 502,513 ****
  		return self._untagged_response(typ, dat, name)
  
  
! 	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')
  
  
--- 508,521 ----
  		return self._untagged_response(typ, dat, name)
  
  
! 	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')
  
  

--127.0.0.1.126.20765.959136629.594.25884--