Changeset 202:269a0c252f9b

Show
Ignore:
Timestamp:
01/27/11 13:55:11 (16 months ago)
Author:
Menno Smits <menno@…>
Branch:
default
Message:

Support for modifiers in the FETCH command (#62)

Files:
4 modified

Legend:

Unmodified
Added
Removed
  • NEWS

    r194 r202  
     1.. -*-Mode: rst; -*- 
     2 
    13===== 
    24 Dev 
     
    5153example. 
    5254 
    53 Added NAMESPACE support (#63) 
    54 ----------------------------- 
     55Added NAMESPACE support (#63) [API CHANGE] 
     56------------------------------------------ 
    5557namespace() method added and get_folder_delimiter() has been deprecated. 
     58 
     59Added support for FETCH modifiers (#62) [NEW] 
     60--------------------------------------------- 
     61The fetch method now takes optional modifiers as the last 
     62argument. These are required for extensions such as RFC 4551 
     63(conditional store). Thanks to Thomas Jost for the patch. 
    5664 
    5765=============== 
  • THANKS

    r117 r202  
    1818    (http://www.voidspace.org.uk/python/mock/) 
    1919 
    20 Mark Hammond <mhammond _AT_ skipinet.com.au) 
    21      Much work related to response parsing. 
     20Mark Hammond (mhammond _AT_ skipinet.com.au) 
     21    Much work related to response parsing and many bug reports. 
     22 
     23Thomas Jost (schnouki _AT_ schnouki.net) 
     24    FETCH modifiers patch. 
    2225 
    2326 
  • imapclient/imapclient.py

    r201 r202  
    490490        @param messages: Message IDs to fetch. 
    491491        @param parts: A sequence of data items to retrieve. 
    492         @param modifiers: An optional sequence of modifiers. 
     492        @param modifiers: An optional sequence of modifiers (where 
     493            supported by the server, eg. ['CHANGEDSINCE 123']). 
    493494        @return: A dictionary indexed by message number. Each item is itself a 
    494495            dictionary containing the requested message parts. 
  • livetest.py

    r198 r202  
    388388            self.assertTrue(body.startswith('om: Bob Smith')) 
    389389 
     390 
     391        def test_fetch_modifiers(self): 
     392            # CONDSTORE (RFC 4551) provides a good way to use FETCH 
     393            # modifiers but it isn't commonly available. 
     394            if not self.client.has_capability('CONDSTORE'): 
     395                return self.skipTest("Server doesn't support CONDSTORE") 
     396 
     397            maxModSeq = int(self.client.select_folder('INBOX')['HIGHESTMODSEQ'][0]) 
     398            self.client.append('INBOX', SIMPLE_MESSAGE) 
     399            msg_id = self.client.search()[0] 
     400 
     401            resp = self.client.fetch(msg_id, ['FLAGS'], ['CHANGEDSINCE %d' % maxModSeq]) 
     402            msg_info = resp[msg_id] 
     403            self.assertIn('MODSEQ', msg_info) 
     404 
     405            # Prove that the modifier is actually being used 
     406            resp = self.client.fetch(msg_id, ['FLAGS'], ['CHANGEDSINCE %d' % (maxModSeq + 1)]) 
     407            self.assertFalse(resp) 
     408             
     409 
    390410        def test_BODYSTRUCTURE(self): 
    391411            self.client.select_folder('INBOX')