Changeset 143:b09900646458 for imapclient
- Timestamp:
- 04/29/10 22:10:51 (2 years ago)
- Branch:
- default
- Location:
- imapclient
- Files:
-
- 2 modified
-
imapclient.py (modified) (3 diffs)
-
test/test_IMAPClient.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
imapclient/imapclient.py
r135 r143 329 329 typ, data = self._imap.list('', self._encode_folder_name(folder)) 330 330 self._checkok('list', typ, data) 331 data = [x for x in data if x] 331 332 return len(data) == 1 and data[0] != None 332 333 … … 629 630 def _encode_folder_name(self, name): 630 631 if self.folder_encode: 631 return imap_utf7.encode(name) 632 return name 632 name = imap_utf7.encode(name) 633 # imaplib assumes that if a command argument (in this case a 634 # folder name) has double quotes around it, then it doesn't 635 # need quoting. This "feature" prevents creation of folders 636 # with names that start and end with double quotes. 637 # 638 # To work around this IMAPClient performs the quoting 639 # itself. This adds start and end double quotes which also 640 # serves to fool IMAP4._checkquote into not attempting further 641 # quoting. A hack but it works. 642 return _quote_arg(name) 633 643 634 644 … … 671 681 672 682 683 def _quote_arg(arg): 684 arg = arg.replace('\\', '\\\\') 685 arg = arg.replace('"', '\\"') 686 return '"%s"' % arg -
imapclient/test/test_IMAPClient.py
r142 r143 117 117 118 118 self.client.append('foobar', sentinel.msg, ['FLAG', 'WAVE'], None) 119 119 120 120 self.assert_(self.client._imap.method_calls == 121 [('append', (' foobar',121 [('append', ('"foobar"', 122 122 '(FLAG WAVE)', 123 123 None, … … 136 136 self.assert_(datetime_to_imap.called) 137 137 self.assert_(self.client._imap.method_calls == 138 [('append', (' foobar',138 [('append', ('"foobar"', 139 139 '(FLAG WAVE)', 140 140 '"somedate"',
