[Python-Dev] Patch making the current email package (mostly) support bytes (original) (raw)

Stephen J. Turnbull stephen at xemacs.org
Fri Oct 8 19:48:23 CEST 2010


R. David Murray writes:

On Sat, 09 Oct 2010 01:06:29 +0900, "Stephen J. Turnbull" <stephen at xemacs.org> wrote:

That mess is entirely unnecessary in Python 3. Text and wire format can be easily distinguished with three different representations of email: Unicode for the conceptual RFC 822 layer (of course this is an extension, because RFC 822 itself is strictly limited to the ASCII subset), bytes for wire format, and Message objects for modern structured mail (including MIME, etc).

That engineering is pretty much what we are looking at, although in practice I think you have to hang wire-format and text-format bits off of appropriate places in the model in order to keep everything properly coordinated.

Right. That's where I was going with my comment to Barry about the Received headers. Even if email isn't going to serve clients working with wire format, it needs to deal with those headers. But where I think the headers defined by RFC 822 should be stored as str in email6, I am leaning toward storing Received headers verbatim as bytes (including any RFC 822 folding whitespace) because of the RFC 5321 requirement that they be preserved exactly.



More information about the Python-Dev mailing list