Re: Append behavior of __setitem__

Barry Warsaw <[email protected]>
Newsgroups gmane.comp.python.mime.devel
Message-ID <[email protected]>
On Apr 11, 2009, at 3:43 AM, Stephen J. Turnbull wrote:

> Barry Warsaw writes:
>
>> So I'm just starting to read RFC 5322 and I'm starting by skimming
>> over Appendix A (differences between RFC 5322 and 2822).
>
> I know Barry's a big supporter of the Postel Principle.  As a
> guideline[1], how far back should we be lenient?  RFC 822 (no  
> leading "2"
> ;-)?
>
> Footnotes:
> [1]  Presumably over time we'll accrete definitely non-conforming
> practices that we need to accept and do something sane with (eg, we
> can't just raise ArmageddonException because we get a header with
> 8-bit characters in it).  But I think we also should have a plan for
> formerly acceptable syntax that has been restricted in more recent
> RFCs, etc.

We could potentially have strict and lenient modes, or possible RFC  
822, 2822, 5322 modes.  OTOH, I feel very strongly that the parser  
should accept just about any stream of bytes without throwing an  
exception.  Thinking about an application like Mailman, it's rather  
inconvenient for the parsing phase to throw any exception.  Much  
better is to register defects and then decide the disposition of  
messages based on the defect list.

OTOH, when creating messages from whole cloth, I think it's okay to  
raise exception.  You just have to be careful because often the same  
APIs are used by the parser.

Barry
PGP.sig (application/pgp-signature, 304 B) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.