imaplib thread method anomaly
Piers Lauder
piers at it.usyd.edu.au
Tue Feb 3 17:07:06 EST 2009
On Tue, 3 Feb 2009 05:22:01 -0800 (PST), Mr SZ wrote:
>
> I was looking at the thread functionality of IMAP4rev1 servers with the
> threading extension. Here is my output with debug=8 :
>
>
>
> 02:23.02 > GDJB3 UID THREAD references UTF-8 (SEEN)
> 02:23.02 < * THREAD (3)(2)(4)(1)
> 02:23.02 matched r'\* (?P<type>[A-Z-]+)( (?P<data>.*))?' => ('THREAD', ' (3)(2)(4)(1)', '(3)(2)(4)(1)')
> 02:23.03 untagged_responses[THREAD] 0 += ["(3)(2)(4)(1)"]
> 02:23.03 < GDJB3 OK Thread completed.
> 02:23.03 matched r'(?P<tag>GDJB\d+) (?P<type>[A-Z]+) (?P<data>.*)' => ('GDJB3', 'OK', 'Thread completed.')
> [None]
>
> ...
>
>
> 02:59.22 > CNCF3 THREAD references UTF-8 (SEEN)
> 02:59.23 < * THREAD (3)(2)(4)(1)
> 02:59.23 matched r'\* (?P<type>[A-Z-]+)( (?P<data>.*))?' => ('THREAD', ' (3)(2)(4)(1)', '(3)(2)(4)(1)')
> 02:59.23 untagged_responses[THREAD] 0 += ["(3)(2)(4)(1)"]
> 02:59.23 < CNCF3 OK Thread completed.
> 02:59.23 matched r'(?P<tag>CNCF\d+) (?P<type>[A-Z]+) (?P<data>.*)' => ('CNCF3', 'OK', 'Thread completed.')
> 02:59.23 untagged_responses[THREAD] => ['(3)(2)(4)(1)']
> ['(3)(2)(4)(1)']
>
>
> As you can see, the first is a UID command and the second is calling the
> thread method. Also, the server responses are the same for both. So why is
> one returning None and the other returning the correct response? I'm using
> python2.4 and I'm stuck with it as I'm using it in a zope environment.
In one of life's weird coincidences - someone else just created
bugs.python.org issue5146 on this.
The fix is a change in the method 'uid' to read:
...
if command in ('SEARCH', 'SORT', 'THREAD'):
name = command
else:
name = 'FETCH'
...
(Thanks to <abhishek at synovel.com>)
Piers Lauder
More information about the Python-list
mailing list