[New-bugs-announce] [issue5146] threading via uid method doesn't work in imaplib

abhishek report at bugs.python.org
Tue Feb 3 20:57:36 CET 2009


New submission from abhishek <abhishek at synovel.com>:

Hi,

IMAP commands in general can be either called directly or via the UID
command which basically returns the UIDs instead of message IDs.
Consider this example:

  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)']


The reason I figured out why UID failed whereas the direct method call
worked lies in this particular line of the method 'uid' in imaplib.py:

        if command in ('SEARCH', 'SORT'):
            name = command
        else:
            name = 'FETCH'

which should be :

        if command in ('SEARCH', 'SORT', 'THREAD'):
            name = command
        else:
            name = 'FETCH'

I was able to confirm this in both 2.4 and 2.5.

Hope this would be looked upon and fixed.

Regards,
Abhishek

----------
components: Library (Lib)
messages: 81094
nosy: abhishek, piers, pierslauder
severity: normal
status: open
title: threading via uid method doesn't work in imaplib
type: behavior
versions: Python 2.4, Python 2.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5146>
_______________________________________


More information about the New-bugs-announce mailing list