]> khamidou — GitHub mirrors - imapclient.git/commitdiff
Merged from trunk
authorMenno Smits <menno@freshfoo.com>
Mon, 11 Jan 2010 19:14:38 +0000 (19:14 +0000)
committerMenno Smits <menno@freshfoo.com>
Mon, 11 Jan 2010 19:14:38 +0000 (19:14 +0000)
1  2 
imapclient/imapclient.py

index d43dbfb3c4811de589741d3b450c5782feae0f23,c77dce1f991ece420705bcf7df96817e026579ca..9f8ab1e4be78b9d3be45bce920fbd04ad5c35d6a
@@@ -439,29 -435,9 +439,29 @@@ class IMAPClient(object)
          parser = FetchParser()
          return parser(data)
  
 +    def altfetch(self, messages, parts):
 +        if not messages:
 +            return {}
 +
 +        msg_list = messages_to_str(messages)
 +        parts_list = seq_to_parenlist([p.upper() for p in parts])
 +
 +        if self.use_uid:
 +            tag = self._imap._command('UID', 'FETCH', msg_list, parts_list)
 +        else:
 +            tag = self._imap._command('FETCH', msg_list, parts_list)
 +        typ, data = self._imap._command_complete('FETCH', tag)
 +        self._checkok('fetch', typ, data)
 +        typ, data = self._imap._untagged_response(typ, data, 'FETCH')
 +        # appears to be a special case - no 'untagged' responses (ie, no
 +        # folders) results in [None]
 +        if data == [None]:
 +          return {}
 +
 +        return parse_fetch_response(data)
  
      def append(self, folder, msg, flags=(), msg_time=None):
-         '''Append a message to a folder
+         """Append a message to a folder
  
          @param folder: Folder name to append to.
          @param msg: Message body as a string.
@@@ -818,12 -793,13 +817,12 @@@ def seq_to_parenlist(flags)
  
  
  def datetime_to_imap(dt):
-     '''Convert a datetime instance to a IMAP datetime string
+     """Convert a datetime instance to a IMAP datetime string
  
      If timezone information is missing the current system timezone is used.
-     '''
+     """
      if not dt.tzinfo:
          dt = dt.replace(tzinfo=FixedOffset.for_system())
 -
      return dt.strftime("%d-%b-%Y %H:%M:%S %z")
 -    
 +