On Wed, 15 Apr 2009 at 20:39, Tony Nelson wrote:
Internally, the Header whose .useful attribute is returned by "msg['foo']"
will contain parsed data, referring to parsed tokens.  Flattening those
parsed tokens will produce the original data.  Not a problem at all, simple
to implement, in the most direct way.

The first part of that is too magical and inconsistent for my tastes.
I want message['fooheader'] to return a Header object.  Which yes,
should contain the parsed token structure and be able to regenerate the
original bytes on demand (or vice versa, or keeping both the original
bytes and the parse tree if the parse tree is lossy).

For a header involving a list of addresses, I'd expect to get back a
Header subclass that I could iterate over to get individual Address
objects.  For other structured headers, I'd expect to get a subclass
with useful methods and attributes for accessing the structure.

And when I str the Header (for example, when presenting one or more
selected headers to a user), I would expect to get a string that a
user would expect to read, which is to say a fully-decoded-to-unicode
user-oriented representation of the structured data as one long string
(I'll do any folding formatting for presentation as needed).

Going the other way I have fewer opinions about, as I haven't written
any code to do that yet :)

--David
_______________________________________________
Email-SIG mailing list
Email-SIG@python.org
Your options: 
http://mail.python.org/mailman/options/email-sig/archive%40mail-archive.com

Reply via email to