FLAGS response with only one flag(i.e. "FLAGS (\Seen)") is not taken in IMAP4Client.__cbSelect
[email protected] Thu, 05 Nov 2009 15:33:20 -0000
| Newsgroups | gmane.comp.python.twisted.bugs |
|---|---|
| Message-ID | <[email protected]> |
New submission from natta <None>:
The prolem is about this part of IMAP4Client.__cbSelect
{{{
def __cbSelect(self, (lines, tagline), rw):
# In the absense of specification, we are free to assume:
# READ-WRITE access
datum = {'READ-WRITE': rw}
lines.append(tagline)
for parts in lines:
split = parts.split()
if len(split) == 2:
if split[1].upper().strip() == 'EXISTS':
try:
datum['EXISTS'] = int(split[0])
except ValueError:
raise IllegalServerResponse(parts)
elif split[1].upper().strip() == 'RECENT':
try:
datum['RECENT'] = int(split[0])
except ValueError:
raise IllegalServerResponse(parts)
else:
log.err('Unhandled SELECT response (1): ' + parts)
elif split[0].upper().strip() == 'FLAGS':
}}}
etc.
When parts variable is equal to "FLAGS (\Seen)" for example ( for * FLAGS (\Seen) response to SELECT command),the length of split list will be 2, but we check only for RECENT or EXISTS responses in case of length equal to 2, so our FLAGS response will be not taken into account.
The solution for this problem is very simple:
the branch
{{{
elif split[0].upper().strip() == 'FLAGS':
split = parts.split(None, 1)
datum['FLAGS'] = tuple(parseNestedParens(split[1])[0])
}}}
should be also added to the if operator in the length = 2 part
----------
Type : defect
Component: mail
Keywords :
Priority : normal
Nosy :
----------
http://twistedmatrix.com/trac/ticket/4069