Changeset 96:6f290ccd5e5b
- Timestamp:
- 05/01/10 13:42:35 (2 years ago)
- Author:
- Menno Smits <menno@…>
- Branch:
- default
- Message:
-
Fixed problem when literal is followed by a non-literal (#33)
This problem manifested itself with GMail's IMAP. Patch based on what
Fergal sent in with the bug report.
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r70
|
r96
|
|
| 23 | 23 | Brian Jackson |
| 24 | 24 | Neil Martinsen-Burrell |
| | 25 | Fergal (fergal _AT_ esatclear.ie) |
| 25 | 26 | |
| 26 | 27 | |
-
|
r93
|
r96
|
|
| 599 | 599 | |
| 600 | 600 | data = data.lstrip() |
| | 601 | msgid = None |
| 601 | 602 | if data[0].isdigit(): |
| 602 | 603 | # Get message ID |
| … |
… |
|
| 606 | 607 | assert data.startswith('('), data |
| 607 | 608 | data = data[1:] |
| 608 | | if data.endswith(')'): |
| 609 | | data = data[:-1] |
| 610 | | |
| 611 | | else: |
| 612 | | msgid = None |
| | 609 | |
| | 610 | if data.endswith(')'): |
| | 611 | data = data[:-1] |
| 613 | 612 | |
| 614 | 613 | for name, item in FetchTokeniser().process_pairs(data): |
-
|
r90
|
r96
|
|
| 180 | 180 | |
| 181 | 181 | def testMultiTypesWithLiteral(self): |
| 182 | | self._parse_test( |
| 183 | | [ |
| 184 | | ('1 (INTERNALDATE " 9-Feb-2007 17:08:08 +0100" RFC822 {21}', |
| 185 | | 'Subject: test\r\n\r\nbody'), |
| 186 | | ')' |
| 187 | | ], |
| 188 | | {1: { |
| 189 | | 'INTERNALDATE': datetime_to_native(datetime.datetime(2007, 2, 9, |
| 190 | | 17, 8, 8, 0, |
| 191 | | FixedOffset(60))), |
| 192 | | 'RFC822': 'Subject: test\r\n\r\nbody', |
| | 182 | expected = {1: {'INTERNALDATE': datetime_to_native(datetime.datetime(2007, 2, 9, |
| | 183 | 17, 8, 8, 0, |
| | 184 | FixedOffset(60))), |
| | 185 | 'RFC822': 'Subject: test\r\n\r\nbody'} |
| 193 | 186 | } |
| 194 | | } |
| 195 | | ) |
| | 187 | self._parse_test([('1 (INTERNALDATE " 9-Feb-2007 17:08:08 +0100" RFC822 {21}', |
| | 188 | 'Subject: test\r\n\r\nbody'), ')'], |
| | 189 | expected) |
| | 190 | |
| | 191 | # Also test where there literal comes back first |
| | 192 | self._parse_test([('1 (RFC822 {21}', 'Subject: test\r\n\r\nbody'), |
| | 193 | 'INTERNALDATE " 9-Feb-2007 17:08:08 +0100")'], |
| | 194 | expected) |
| 196 | 195 | |
| 197 | 196 | def testLiteralsWithSections(self): |