Commit Graph

299 Commits

Author SHA1 Message Date
Tim Peters e718f615b8 Whitespace normalization. 2004-10-12 21:51:32 +00:00
Anthony Baxter 3dd9e46161 Added a usegmt flag to email.Utils.formatdate - this allows it to be
used to replace rfc822.formatdate for protocols like HTTP (where 'GMT' must
be the timezone string).
2004-10-11 13:53:08 +00:00
Barry Warsaw 2294bfc19d All known bugs are closed, and Python 2.4b1 is coming out soon, so bump
email's version number to 3.0b1.
2004-10-09 23:01:11 +00:00
Barry Warsaw dee0cf12e3 Fix SF bug # 1030941. In _parsegen(), in the clause where we're
capturing_preamble but we found a StartBoundaryNotFoundDefect, we need to
consume all lines from the current position to the EOF, which we'll set as the
epilogue of the current message.  If we're not at EOF when we return from
here, the outer message's capturing_preamble assertion will fail.
2004-10-09 23:00:11 +00:00
Barry Warsaw 6bd55ee1ef An example message for SF bug # 1030941. 2004-10-09 22:57:57 +00:00
Barry Warsaw 83f1a1b1f7 test_missing_start_boundary(): A test for SF bug # 1030941. 2004-10-09 22:57:33 +00:00
Barry Warsaw ea7c7af10b __init__(): Coerce the input_charset to unicode (with ascii encoding) before
calling .lower() on it.  This fixes the problem described in SF patch # 866982
where in the tr_TR.ISO-8859-9 locale, 'I'.lower() isn't 'i'.  unicodes are
locale insensitive.
2004-10-09 21:08:30 +00:00
Barry Warsaw 1b643596a8 Fix test for FeedParser results. 2004-10-03 04:02:43 +00:00
Barry Warsaw 05bef930fa as_string(): Indicate that this mangles From_ lines. 2004-10-03 03:38:07 +00:00
Barry Warsaw bb11386730 Big email 3.0 API changes, with updated unit tests and documentation.
Briefly (from the NEWS file):

- Updates for the email package:
  + All deprecated APIs that in email 2.x issued warnings have been removed:
    _encoder argument to the MIMEText constructor, Message.add_payload(),
    Utils.dump_address_pair(), Utils.decode(), Utils.encode()
  + New deprecations: Generator.__call__(), Message.get_type(),
    Message.get_main_type(), Message.get_subtype(), the 'strict' argument to
    the Parser constructor.  These will be removed in email 3.1.
  + Support for Python earlier than 2.3 has been removed (see PEP 291).
  + All defect classes have been renamed to end in 'Defect'.
  + Some FeedParser fixes; also a MultipartInvariantViolationDefect will be
    added to messages that claim to be multipart but really aren't.
  + Updates to documentation.
2004-10-03 03:16:19 +00:00
Barry Warsaw 06fa042034 Test cases and fixes for bugs described in patch #873418: email/Message.py:
del_param fails when specifying a header.
2004-08-16 15:47:34 +00:00
Barry Warsaw e8bedeb45b Resolution of bug #997368, "strftime() backward compatibility".
Specifically, time.strftime() no longer accepts a 0 in the yday position of a
time tuple, since that can crash some platform strftime() implementations.

parsedate_tz(): Change the return value to return 1 in the yday position.

Update tests in test_rfc822.py and test_email.py
2004-08-07 16:38:40 +00:00
Barry Warsaw 8896bf56a2 Resolution of SF bug #1002475 and patch #1003693; Header lines that end in
\r\n only get the \n stripped, not the \r (unless it's the last header which
does get the \r stripped).  Patch by Tony Meyer.

test_whitespace_continuation_last_header(),
test_strip_line_feed_and_carriage_return_in_headers(): New tests.

_parse_headers(): Be sure to strip \r\n from the right side of header lines.
2004-08-07 15:57:52 +00:00
Barry Warsaw e4aeb7d1f1 _parsegen(): Add a missing check for NeedMoreData. 2004-05-15 16:26:28 +00:00
Barry Warsaw ac606ccb79 forward porting from release23-maint 2004-05-13 23:18:54 +00:00
Barry Warsaw 2178a6d1a2 test_boundary_in_non_multipart(): Added a test for SF bug # 846938. 2004-05-13 23:17:04 +00:00
Barry Warsaw 61e5616d74 encode_7or8bit(): Clearing out some old patches; iso-2202 is non-ASCII but
still 7-bit.
2004-05-13 22:50:12 +00:00
Barry Warsaw 4e59bc1e67 readline(): RFC 2046, section 5.1.2 (and partially 5.1) both state that the
parser must recognize outer boundaries in inner parts.  So cruise through the
EOF stack backwards testing each predicate against the current line.

There's still some discussion about whether this is (always) the best thing to
do.  Anthony would rather parse these messages as if the outer boundaries were
ignored.  I think that's counter to the RFC, but might be practically more
useful.  Can you say behavior flag?  (ug).
2004-05-13 20:17:51 +00:00
Barry Warsaw 58eb0fcb8f test_nested_inner_contains_outer_boundary(), test_nested_with_same_boundary():
Two evil samples from Anthony's MIME torture tests.
2004-05-13 20:15:20 +00:00
Barry Warsaw d49f1d6c5a _structure(): Make sure all output goes the to fp object. 2004-05-13 20:14:20 +00:00
Barry Warsaw d0c12af7ef Another evil test from Anthony's suite. This one has an inner part with the
same boundary as the outer part.
2004-05-13 20:13:48 +00:00
Barry Warsaw dce231fb14 A boiled down example from Anthony's MIME torture tests. This one has a
separating boundary for an outer part inside an inner part.
2004-05-13 20:12:32 +00:00
Barry Warsaw 486cb0ac2a Tests for message/external-body and for duplicate boundary lines. 2004-05-11 22:23:59 +00:00
Barry Warsaw b067e6287b More boiled down tests from Anthony's big torture suite. 2004-05-11 22:21:56 +00:00
Barry Warsaw 769f14a7c9 A boiled down message/external-body example from Anthony's torture test. 2004-05-11 22:20:59 +00:00
Barry Warsaw bce827bf12 An example with multiple boundary lines. 2004-05-11 22:20:05 +00:00
Barry Warsaw d38f448865 _parsegen(): Move the message/rfc822 clause to after the
message/delivery-status clause, and genericize it to handle all (other)
message/* content types.  This lets us correctly parse 2 more of Anthony's
MIME torture tests (specifically, the message/external-body examples).
2004-05-11 20:19:09 +00:00
Barry Warsaw 5b44cd64d7 _parsegen(): Watch out for empty epilogues. 2004-05-11 18:10:15 +00:00
Barry Warsaw c29db26529 _parse_headers(): Strip a trailing newline from the envelope header. Closes
SF #951088.
2004-05-10 14:48:30 +00:00
Barry Warsaw 6f3b033774 _split_ascii(): Small optimization by RH. 2004-05-10 14:44:04 +00:00
Barry Warsaw d285600883 SF patch # 884030 by Amit Aronovitch; fixes the _subpart argument to match
documented semantics.
2004-05-09 18:04:24 +00:00
Barry Warsaw bfe18c096f test_mime_attachments_in_constructor(): New test to check for SF bug # 884030. 2004-05-09 18:03:36 +00:00
Barry Warsaw 2c823d67e3 we dont support any Python's before 2.3 now. 2004-05-09 03:57:09 +00:00
Barry Warsaw 24f79762a1 Update to Python 2.3, getting rid of backward compatiblity crud. 2004-05-09 03:55:11 +00:00
Barry Warsaw 235c8eba62 Update to Python 2.3, getting rid of backward compatiblity crud.
This Parser is now just a backward compatible front-end to the FeedParser.
2004-05-09 03:46:42 +00:00
Barry Warsaw 5d84053e2c Update to Python 2.3, getting rid of backward compatiblity crud. 2004-05-09 03:44:55 +00:00
Barry Warsaw 4c3e33a80b Update to Python 2.3, getting rid of backward compatiblity crud. We don't
need the _compat21 or _compat22 modules either.
2004-05-09 03:42:37 +00:00
Barry Warsaw 3d1f397f1a Update to Python 2.3, getting rid of backward compatiblity crud. Get rid of a
bunch of module globals that aren't used.
2004-05-09 03:40:17 +00:00
Barry Warsaw 36112f2d34 Update to Python 2.3, getting rid of backward compatiblity crud. Get rid of a
bunch of module globals that aren't used.

__maxheaderlen -> _maxheaderlen

_handle_multipart(): This should be more RFC compliant now, and does match the
updated/fixed semantics for preamble and epilogue.
2004-05-09 03:35:17 +00:00
Barry Warsaw 418101fd64 An updated FeedParser that should be RFC complaint, passes all existing
(standard) tests, and doesn't throw parse errors.  I still need throw
Anthony's torture test at it, but I wanted to get this checked in and off my
disk.
2004-05-09 03:29:23 +00:00
Barry Warsaw 333e830b83 Add MessageDefect and subclasses. 2004-05-09 03:26:07 +00:00
Barry Warsaw 41f6ad6171 Update to Python 2.3, getting rid of backward compatiblity crud. 2004-05-09 03:24:43 +00:00
Barry Warsaw 09356d419c Like msg_12.txt but with some extra vertical whitespace around the inner
message's end boundary.
2004-05-09 03:17:29 +00:00
Barry Warsaw b8b57e75b2 A bunch of new tests, and updated tests for the email 3.0 FeedParser. 2004-05-09 03:16:03 +00:00
Anthony Baxter 39a0f04421 New parser. Next up, making the current parser use this parser 2004-03-22 00:33:28 +00:00
Thomas Wouters 1e1305491b test_email: comment out two fail-test cases that no longer fail with the new
parser -- for now. Failure behaviour of the new parser(s) will change in any
case, so this will be revisited later anyway.
2004-03-20 20:29:50 +00:00
Thomas Wouters 0813d76cb0 Merge in Anthony's new parser code, from the anthony-parser-branch:
> ----------------------------
> revision 1.20.4.4
> date: 2003/06/12 09:14:17;  author: anthonybaxter;  state: Exp;  lines: +13 -6
> preamble is None when missing, not ''.
> Handle a couple of bogus formatted messages - now parses my main testsuite.
> Handle message/external-body.
> ----------------------------
> revision 1.20.4.3
> date: 2003/06/12 07:16:40;  author: anthonybaxter;  state: Exp;  lines: +6 -4
> epilogue-processing is now the same as the old parser - the newline at the
> end of the line with the --endboundary-- is included as part of the epilogue.
> Note that any whitespace after the boundary is _not_ part of the epilogue.
> ----------------------------
> revision 1.20.4.2
> date: 2003/06/12 06:39:09;  author: anthonybaxter;  state: Exp;  lines: +6 -4
> message/delivery-status fixed.
> HeaderParser fixed.
> ----------------------------
> revision 1.20.4.1
> date: 2003/06/12 06:08:56;  author: anthonybaxter;  state: Exp;  lines: +163 -129
> A work-in-progress snapshot of the new parser. A couple of known problems:
>
> - first (blank) line of MIME epilogues is being consumed
> - message/delivery-status isn't quite right
>
> It still needs a lot of cleanup, but right now it parses a whole lot of
> badness that the old parser failed on. I also need to think about adding
> back the old 'strict' flag in some way.
> =============================================================================
2004-03-20 17:31:29 +00:00
Hye-Shik Chang 3e2a306920 Add CJK codecs support as discussed on python-dev. (SF #873597)
Several style fixes are suggested by Martin v. Loewis and
Marc-Andre Lemburg. Thanks!
2004-01-17 14:29:29 +00:00
Barry Warsaw 4a44293735 Fixes to support CJKCodecs as per SF bug #852347. Actually, this
patch removes dependencies on the old unsupported KoreanCodecs package
and the alternative JapaneseCodecs package.  Since both of those
provide aliases for their codecs, this removal just makes the generic
codec names work.

We needed to make slight changes to __init__() as well.

This will be backported to Python 2.3 when its branch freeze is over.
2003-12-30 16:52:25 +00:00
Barry Warsaw 339270e6f5 Bump version number to 2.5.5 2003-12-30 16:49:40 +00:00