summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-03-13 18:24:40 (GMT)
committerGeorg Brandl <georg@python.org>2007-03-13 18:24:40 (GMT)
commit6c104f6906bc7203f39a15bcc8b3d3905c7333e8 (patch)
treed93b0f1754be63944c86de26fa255399a60ac1fb
parent9e6b47002a563473ec966ac4d353b99df986f642 (diff)
downloadcpython-6c104f6906bc7203f39a15bcc8b3d3905c7333e8.zip
cpython-6c104f6906bc7203f39a15bcc8b3d3905c7333e8.tar.gz
cpython-6c104f6906bc7203f39a15bcc8b3d3905c7333e8.tar.bz2
Patch #1605192: list allowed states in error messages for imaplib.
-rw-r--r--Lib/imaplib.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/Lib/imaplib.py b/Lib/imaplib.py
index 08e1520..e30ae39 100644
--- a/Lib/imaplib.py
+++ b/Lib/imaplib.py
@@ -746,8 +746,10 @@ class IMAP4:
if not command in Commands:
raise self.error("Unknown IMAP4 UID command: %s" % command)
if self.state not in Commands[command]:
- raise self.error('command %s illegal in state %s'
- % (command, self.state))
+ raise self.error("command %s illegal in state %s, "
+ "only allowed in states %s" %
+ (command, self.state,
+ ', '.join(Commands[command])))
name = 'UID'
typ, dat = self._simple_command(name, command, *args)
if command in ('SEARCH', 'SORT'):
@@ -811,8 +813,10 @@ class IMAP4:
if self.state not in Commands[name]:
self.literal = None
- raise self.error(
- 'command %s illegal in state %s' % (name, self.state))
+ raise self.error("command %s illegal in state %s, "
+ "only allowed in states %s" %
+ (name, self.state,
+ ', '.join(Commands[name])))
for typ in ('OK', 'NO', 'BAD'):
if typ in self.untagged_responses: