[Email-SIG] Some parsing/generation issues of email in Python 3

2016-06-08 Thread Stephen J. Turnbull
Hans-Peter Jansen writes: > Dear audience, > > when coming back to this list, I couldn't believe my eyes because > of the low volume level, but after rechecking with the archives, I > have to accept, it is that quiet here, a bit too quiet from my > POV. Hmm. It's just that very few people

Re: [Email-SIG] API for email threading library?

2012-01-09 Thread Stephen J. Turnbull
Bill Janssen writes: I think I'll finesse this issue with another (appropriate) layer of indirection. OK by me (can't bring myself to +1 on a thoughtful finesse. :) In a Lisp implementation of http://www.jwz.org/doc/threading.html I'm working on, I just use symbols named by the

Re: [Email-SIG] header folding

2011-07-28 Thread Stephen J. Turnbull
Glenn Linderman writes: To me, wrap means to divide and join as necessary a set of lines (sometimes/often a paragraph) to achieve some number of similar length lines, not to exceed a line length limit, with possibly a shorter one at the end. Typically such usage is in contexts where a

Re: [Email-SIG] header folding

2011-07-27 Thread Stephen J. Turnbull
R. David Murray writes: Hmm. Makes sense to me. So you'd rather the method were called fold and that refold_source remains the name of the policy control. Yes. What's the word for what is done when a text message is made to have a line length of less than 78 by using quoted printable

Re: [Email-SIG] header folding

2011-07-27 Thread Stephen J. Turnbull
R. David Murray writes: That's an interesting point. So perhaps I should rename the control 'header_source_refold'. I don't know have a strong opinion, but I tend to think it's unnecessary. On the other hand, we could also provide a separate control for whether or not quoted printable

Re: [Email-SIG] header folding

2011-07-27 Thread Stephen J. Turnbull
Barry Warsaw ba...@python.org writes: That's at least what I think of, and I do think we could have two knows to control the different functionality: - To 'split' a line means to take a line longer than a specified maximum, and make it fit into the maximum line length, splitting at

[Email-SIG] header folding

2011-07-25 Thread Stephen J. Turnbull
R. David Murray writes: the end. Basically, BaseHeader gets a 'wrap' method, and there is a new policy control, 'refold_source' (I'll probably rename it to 'rewrap_source', since I expect to apply it also to message bodies). This bothers me. Folding and wrapping are two different

[Email-SIG] question on syntax of 'group' in address-list

2011-05-16 Thread Stephen J. Turnbull
R. David Murray writes: I've gone through the RFCs and done some additional googling, and haven't been able to confirm the answer to this question: what exactly is the syntax when a group is included in an address-list? (See http://tools.ietf.org/html/rfc5322#section-3.4). The question

Re: [Email-SIG] [Python-Dev] email package status in 3.X

2010-06-17 Thread Stephen J. Turnbull
l...@rmi.net writes: FWIW, after rewriting Programming Python for 3.1, 3.x still feels a lot like a beta to me, almost 2 years after its release. Email, of course, is a big wart. But guess what? Python 2's email module doesn't actually work! Sure, the program runs most of the time, but

Re: [Email-SIG] invertability and idempotence

2009-10-22 Thread Stephen J. Turnbull
Andrew McNamara writes: The discussion had referred to idempotency up until that point, and I didn't want to introduce new terminology. But referring to this: generate(parse(msg)) == msg as idempotency is perfectly valid in my opinion (as in, applying an operation multiple

Re: [Email-SIG] invertability and idempotence

2009-10-22 Thread Stephen J. Turnbull
Andrew McNamara writes: didn't want to introduce new terminology. But referring to this: generate(parse(msg)) == msg as idempotency is perfectly valid in my opinion (as in, applying an operation multiple times produces the same result). That would be

Re: [Email-SIG] fixing the current email module

2009-10-12 Thread Stephen J. Turnbull
Barry Warsaw writes: I would proposal a radical suggestion: we treat backward compatibility the way Python 3 did. Nice to keep, but we can throw it over the side in order to fix the warts. We'll worry about migration strategy later. +1 Aside: I would really like to have a much

Re: [Email-SIG] fixing the current email module

2009-10-11 Thread Stephen J. Turnbull
Glenn Linderman writes: conformant is not in the dictionaries I've consulted. Try these (top 3 goggle results for conformant): conformant- WordWeb dictionary definition (computing) conforming to a particular specification or standard In this paper we present a new approach to

Re: [Email-SIG] fixing the current email module

2009-10-10 Thread Stephen J. Turnbull
the keyboard of Stephen J. Turnbull: Actually, I would say you are emitting leniently, in violation of the Postel principle. You can say that, but I don't have to believe it. I'm talking about accepting; the message has arrived, it is here, the client is trying to look

Re: [Email-SIG] fixing the current email module

2009-10-10 Thread Stephen J. Turnbull
Glenn Linderman writes: On approximately 10/9/2009 3:08 PM, came the following characters from the keyboard of Tokio Kikuchi: Your suggestions 1)-4) are not accesptable to Japanese users at all. If a message with an encoded header arrives (like your number 2 sample) but it cannot

Re: [Email-SIG] fixing the current email module

2009-10-10 Thread Stephen J. Turnbull
R. David Murray writes: I have set up two more documents on the wiki. One is UseCases[1], [...]. The other is a Glossary[2]. Thank you, very much! I think most of it accurately reflects the consensus here, but in it I'm proposing to use the term 'transfer-decoded' for #3, and

Re: [Email-SIG] fixing the current email module

2009-10-10 Thread Stephen J. Turnbull
Glenn Linderman writes: (I switched conformant to compliant, Conformant is in common use. You might be more comfortable with conforming. Richard Stallman points out that you comply with the law, but you conform to a standard. I think it's useful to make that semantic distinction, cf. RFC

Re: [Email-SIG] fixing the current email module

2009-10-08 Thread Stephen J. Turnbull
Oleg Broytman writes: On Wed, Oct 07, 2009 at 11:23:24AM -0500, Matthew Dixon Cowles wrote: In my opinion, the email module should never raise an exception as a result of working with a malformed message. Though it should certainly make the information that a message was malformed

Re: [Email-SIG] fixing the current email module

2009-10-08 Thread Stephen J. Turnbull
Glenn Linderman writes: If conversions are avoided, then octets are unlikely to be out of range? Haven't looked in your spam bucket recently, I guess. Spammers regularly put 8 bit characters into headers (and into bodies in messages without a Content-Type header), for one

Re: [Email-SIG] fixing the current email module

2009-10-08 Thread Stephen J. Turnbull
Oleg Broytman writes: where not. By punt I mean return a special object containing as much of the meta data for an object as it could recover, along with the data itself as a blob. The special object is an instance of an exception class ;) It could be, but it will be returned

Re: [Email-SIG] fixing the current email module

2009-10-08 Thread Stephen J. Turnbull
Barry Warsaw writes: from email import message_from_string with open('/dev/urandom') as wire: ... data = wire.read(1024) ... # insert A msg = message_from_string(data) # number of headers ... len(msg) 0 len(msg.get_payload()) 1024 msg.defects [] This

Re: [Email-SIG] fixing the current email module

2009-10-08 Thread Stephen J. Turnbull
Barry Warsaw writes: On Oct 8, 2009, at 3:29 AM, Glenn Linderman wrote: Headers could possibly be a quadruple instead of a triple, with the 4th item being the wire format if received? I think the whole input format (note, not necessarily wire!) should be saved off on the top-level

Re: [Email-SIG] fixing the current email module

2009-10-08 Thread Stephen J. Turnbull
Barry Warsaw writes: Yeah, idempotency probably is not the right term, though I think historically that's what's been used. Math geeks, what's the right term here? :) Invertability *is* the math term. Roundtrip is more likely to make sense to real people. I completely agree with

Re: [Email-SIG] fixing the current email module

2009-10-08 Thread Stephen J. Turnbull
Bill Janssen writes: I should point out that I also store lots of metadata in the registered MIME format text/rfc822-headers (defined in RFC 1892), data that doesn't necessarily conform to the specific set of headers mentioned in RFC822. It would be nice if the header support in the email

Re: [Email-SIG] fixing the current email module

2009-10-08 Thread Stephen J. Turnbull
Glenn Linderman writes: Conversions will eventually be done. Best it were done quickly. Disagree. Deferring the conversions defers failure issues to the point where the code (hopefully) somewhat understands the type of data being manipulated, and can then handle it appropriately.

Re: [Email-SIG] fixing the current email module

2009-10-07 Thread Stephen J. Turnbull
Glenn Linderman writes: If you mean that the email module will keep track of what form the object is currently represented by, that will eventually result in UnicodeError: octet out of range: 161, ascii. The above sentence does not communicate your meaning to me... or any

Re: [Email-SIG] fixing the current email module

2009-10-06 Thread Stephen J. Turnbull
Glenn Linderman writes: Yes, I interpreted, possibly misinterpreted, Barry's comment about storing things as bytes, as that he was figuring to store them in wire format. What that means is unclear, though. Does a header in wire format mean before or after MIME encoding? Probably after,

Re: [Email-SIG] Ensuring 7 bit encoding

2009-08-28 Thread Stephen J. Turnbull
R. David Murray writes: import email.message m = email.message.Message() m.set_payload(A few lines ... of 8-bit text ... ... One high bit character: ². ... , 'us-ascii') print m.as_string() MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii

Re: [Email-SIG] Generating zipped or gzipped attachment with emailpackage?

2009-05-21 Thread Stephen J. Turnbull
Mark Sapiro writes: Ideally, one would be able to specify a parameter on the Content-Type; header along the lines of Content-Type: text/csv; charset=utf-8; compression=gzip No, I think this is really a content transfer encoding, not part of Content-Type, and I don't see why one would be

Re: [Email-SIG] API for Header objects

2009-04-17 Thread Stephen J. Turnbull
Tony Nelson writes: This example seems tortured and contrived. Not at all. I currently use grep, not the email package, but in fact I extract several headers for use in mailing list moderation. It's getting to the point where my gradually accreting shell script doesn't cut it (more because

Re: [Email-SIG] API for Header objects [was: Dropping bytes support in json]

2009-04-17 Thread Stephen J. Turnbull
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.

Re: [Email-SIG] API for Header objects [was: Dropping bytes support in json]

2009-04-17 Thread Stephen J. Turnbull
as pickles of Header objects via Firewire sockets implanted in their skulls. There is *no /unique/ correct way* here. For example (this is a trick question), in your opinion, what should msg['To'][0] return if the original header was To: Stephen J. Turnbull step...@xemacs.org

Re: [Email-SIG] API for Header objects [was: Dropping bytes support in json]

2009-04-17 Thread Stephen J. Turnbull
R. David Murray writes: put Header objects into it. I don't think the overhead of having to do message['Subject'] = Header('subject string') Hm. Should a Header know which header it is? Ie, should that be message['Subject'] = Header('subject', 'subject string') ? (I

Re: [Email-SIG] API for Header objects [was: Dropping bytes support in json]

2009-04-14 Thread Stephen J. Turnbull
Tony Nelson writes: Assuming that by Destination you mean a class of Address header fields, as there is no Destionation: header field, such header fields contain addresses, which can be considered to contain (as the email package does) a list of (name, email address) pairs, or, at a lower

Re: [Email-SIG] [Python-Dev] Dropping bytes support in json

2009-04-10 Thread Stephen J. Turnbull
Shouldn't this thread move lock stock and .signature to email-sig? Barry Warsaw writes: It does seem to make sense to think about headers as text header names and text header values. I disagree. IMHO, structured header types should have object values, and something like

Re: [Email-SIG] [Python-Dev] the email module, text, and bytes (was Re: Dropping bytes support in json)

2009-04-10 Thread Stephen J. Turnbull
Bill Janssen writes: Barry Warsaw ba...@python.org wrote: In that case, we really need the bytes-in-bytes-out-bytes-in-the-chewy- center API first, and build things on top of that. Yep. Uh, I hate to rain on a parade, but isn't that how we arrived at the *current* email

Re: [Email-SIG] [Python-Dev] Dropping bytes support in json

2009-04-09 Thread Stephen J. Turnbull
Barry Warsaw writes: There are really two ways to look at an email message. It's either an unstructured blob of bytes, or it's a structured tree of objects. Indeed! Those objects have headers and payload. The payload can be of any type, though I think it generally breaks down into

Re: [Email-SIG] email.header.decode_header eats my spaces

2007-03-28 Thread Stephen J. Turnbull
Barry Warsaw writes: Steve writes: IMHO, the Header class should be abstract, and there should be subclasses that handle dates, lists of addresses, lists of message-ids, etc. I'm not sure inheritance is the right way to organize this. I picked inheritance because I see the header