On Fri, 17 Apr 2009 at 19:20, Stephen J. Turnbull wrote:
R. David Murray writes:

> Note that while I want to be able to do str(someHeader) to get a
> string representation of a header body, I'm not so enamored of being
> able to do
>
>      message['From'] = 'John Smith <j...@foo.com>'
>
> and have it get turned into a Header or AddressHeader object.
> Frankly, that looks too magical to me.

+1

Well, that would make it easy to write scripts that parse lists of
addresses and do things with them.  Eg, a mailing list manager's "mass
subscribe" interface.  That would be nice ... but on reflection it's
clear that we would want that to be parsed *strictly*.  So it raises
exceptions, which must be caught and handled, etc etc.  In other
words, it's actually not so easy to write scripts, no matter what you
do, and you also want to be able to specify what kind of magical
fixups (the ever-popular "display-name with unquoted period"
immediately comes to mind as one example) are acceptable, and which
are not, not to mention encoding for non-ASCII text.

How about unstructured header bodies, like "Subject"?  Should we allow
it, for convenience, or not, for consistency?

How about unknown fields, eg "X-Are-We-Not-Structured-No-We-Are-Devo"?

I think, in the first draft, we should be *consistent* in both cases.

Yes, I think consistency is good.  Since I'm visualizing a message as
being a container for headers (as well as the body...but we aren't
talking about that right now), I would expect that I'd have to
put Header objects into it.  I don't think the "overhead" of
having to do

    message['Subject'] = Header('subject string')

is very large, and the code feels better to me that way (if I get
Headers out, I should be putting Headers in..."explicit is better
than implicit").

As for parsing a list of addresses in a manager interface...presumably
we want to provide address-parsing tools to make that job easier.
Folding address parsing in to a header setting operation would make
that scripting task _harder_.  Header creation should provide an easy
way to pass in user address input as Unicode strings, but underlying
that should be a more atomic address parsing interface.

--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