diff options
author | Guido van Rossum <guido@python.org> | 2000-02-28 22:37:30 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2000-02-28 22:37:30 (GMT) |
commit | 619c33787b935eafa847ace6f2cdc7f696937e88 (patch) | |
tree | 8f383533f60274a55798ce9a34f7d2adfd32acaf /Lib | |
parent | c517b9b40646a2aac735a82a0334fbc4bff04654 (diff) | |
download | cpython-619c33787b935eafa847ace6f2cdc7f696937e88.zip cpython-619c33787b935eafa847ace6f2cdc7f696937e88.tar.gz cpython-619c33787b935eafa847ace6f2cdc7f696937e88.tar.bz2 |
Patch by Piers Lauder, who writes:
This patch is re: Lucas.Dejonge@awtpl.com.au: [Python-bugs-list] imaplib -
not complying with RFC (PR#218)
Lucas de Jonge reported that the code in imaplib that detects a read-write
to read-only change doesn't comply with RFC 2060.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/imaplib.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Lib/imaplib.py b/Lib/imaplib.py index 9389b22..7b5526e 100644 --- a/Lib/imaplib.py +++ b/Lib/imaplib.py @@ -15,7 +15,7 @@ Public functions: Internaldate2tuple # # Authentication code contributed by Donn Cave <donn@u.washington.edu> June 1998. -__version__ = "2.32" +__version__ = "2.33" import binascii, re, socket, string, time, random, sys @@ -128,6 +128,7 @@ class IMAP4: self.tagged_commands = {} # Tagged commands awaiting response self.untagged_responses = {} # {typ: [data, ...], ...} self.continuation_response = '' # Last continuation response + self.is_readonly = None # READ-ONLY desired state self.tagnum = 0 # Open socket to server. @@ -470,6 +471,7 @@ class IMAP4: """ # Mandated responses are ('FLAGS', 'EXISTS', 'RECENT', 'UIDVALIDITY') self.untagged_responses = {} # Flush old responses. + self.is_readonly = readonly if readonly: name = 'EXAMINE' else: @@ -479,7 +481,7 @@ class IMAP4: self.state = 'AUTH' # Might have been 'SELECTED' return typ, dat self.state = 'SELECTED' - if not self.untagged_responses.has_key('READ-WRITE') \ + if self.untagged_responses.has_key('READ-ONLY') \ and not readonly: if __debug__: if self.debug >= 1: @@ -594,9 +596,8 @@ class IMAP4: if self.untagged_responses.has_key(typ): del self.untagged_responses[typ] - if self.untagged_responses.has_key('READ-WRITE') \ - and self.untagged_responses.has_key('READ-ONLY'): - del self.untagged_responses['READ-WRITE'] + if self.untagged_responses.has_key('READ-ONLY') \ + and not self.is_readonly: raise self.readonly('mailbox status changed to READ-ONLY') tag = self._new_tag() |