Quantcast

email-6.0.0.a1

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

email-6.0.0.a1

R. David Murray
OK, so I've released the first iteration of the email6 package on pypi
as email-6.0.0a1.  After install you import it as email6.  This will
allow anyone curious and/or motivated to test it out under Python 3.2.
I'm especially interested in anyone with a working program that uses
email in 3.2: it should be completely backward compatible, and if it
isn't I want to know ASAP.[*]

I've also opened issue 12586 for review of the delta between default
and the code that is in the release.  I'd like to check the code in
to default and continue to work on it from there.  As I said in the
issue comments: "When we originally planned out email6 we thought we'd
be making a "compatibility break" with backward compatibility shims.
As things have turned out the work is more a matter of incremental
improvement of the API while maintaining the old API, and thus it seems
reasonable to me to work on it directly in default rather than continue
to work on it in a separate feature branch."  Assuming, that is, that
the general approach represented by *this* delta is accepted.

What this delta adds to email is a conversion to handling all headers as
full blown objects (as opposed to strings, tuples of strings, or Header
objects, depending on context).  The object type is a subclass of str,
so the headers act like strings if you don't use their additional API.
The basic additional API is that a 'source' attribute contains the
text the generator read from the input source, and a 'value' attribute
that contains the value with all the Content-Transfer-Encoding stuff
undone so that you have a real unicode string.  By changing a policy
setting, you can have that value as the string value of the header.
You can also assign a string with non-ASCII characters to a header, and
the right thing will happen.  (Well, eventually it will happen...right
now it only works correctly for unstructured headers).  Further, Date
headers have a datetime attribute (and accept being set to a datetime),
and address headers have attributes for accessing the individual addresses
in the header.  Other structured headers will eventually grow additional
attributes as well.

The general approach has been discussed with and approved by the email-sig,
but all comments are welcome.  I know there's room for bikeshedding
on some aspects of the API; in some cases I've dome some "placeholder"
stuff pending a more complete solution to certain design goals.

I have a big project in the offing over the next couple months.  QNX is
still fully behind the funding for email6 development, but I probably
won't be able to complete it until the fall.  So I'd like to get this
chunk (the biggest chunk of new code, considering the size of the parser)
reviewed and checked in if possible.  I'll keep working on the bits of
functionality that aren't quite complete and the bugs that I know are
there until my big project kicks off, but I wanted to release/post now
so that there might be a chance of some review happening while I still
have time to respond quickly to the feedback.

--
R. David Murray           http://www.bitdance.com

[*] I believe that if you try to use an email6 Message object with the 3.2
mailbox module you will run in to some trouble, but I think it ought to
be possible to make it work with the right magic :)

PS: I don't have much experience writing parsers, so I'm expecting some
critical comments about my parser design.  It had to be a custom parser
since otherwise I'd be blocked on waiting for some other software to
get accepted into the stdlib, but it certainly wound up being a bigger
chunk of code than I expected when I started writing it.
_______________________________________________
Email-SIG mailing list
[hidden email]
Your options: http://mail.python.org/mailman/options/email-sig/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: email-6.0.0.a1

Barry Warsaw
On Jul 19, 2011, at 05:21 PM, R. David Murray wrote:

>OK, so I've released the first iteration of the email6 package on pypi
>as email-6.0.0a1.  After install you import it as email6.  This will
>allow anyone curious and/or motivated to test it out under Python 3.2.
>I'm especially interested in anyone with a working program that uses
>email in 3.2: it should be completely backward compatible, and if it
>isn't I want to know ASAP.[*]

It'll take some time to digest, but congratulations RDM!  You've accomplished
an impressive milestone.

-Barry

_______________________________________________
Email-SIG mailing list
[hidden email]
Your options: http://mail.python.org/mailman/options/email-sig/lists%40nabble.com

signature.asc (853 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: email-6.0.0.a1

Axel Rau
In reply to this post by R. David Murray

Am 19.07.2011 um 23:21 schrieb R. David Murray:

> I'm especially interested in anyone with a working program that uses
> email in 3.2: it should be completely backward compatible, and if it
> isn't I want to know ASAP.[*]
I just started testing a SpamCop reporter (800 lines of code).
Runs perfect so far.

Axel
---
PGP-Key:29E99DD6  ☀ +49 151 2300 9283  ☀ computing @ chaos claudius

_______________________________________________
Email-SIG mailing list
[hidden email]
Your options: http://mail.python.org/mailman/options/email-sig/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: email-6.0.0.a1

Axel Rau

Am 29.07.2011 um 13:18 schrieb Axel Rau:

>
> Am 19.07.2011 um 23:21 schrieb R. David Murray:
>
>> I'm especially interested in anyone with a working program that uses
>> email in 3.2: it should be completely backward compatible, and if it
>> isn't I want to know ASAP.[*]
> I just started testing a SpamCop reporter (800 lines of code).
> Runs perfect so far.
1st problem:
----
Traceback (most recent call last):
 File "/usr/local/etc/exim/erdb_bt.py", line 834, in <module>
   reporter.addReport(spam)
 File "/usr/local/etc/exim/erdb_bt.py", line 227, in addReport
   self.flushReports()
 File "/usr/local/etc/exim/erdb_bt.py", line 258, in flushReports
   smtp.send_message(self.msg)
 File "/usr/local/lib/python3.2/smtplib.py", line 790, in send_message
   g.flatten(msg, linesep='\r\n')
 File "/usr/local/lib/python3.2/email/generator.py", line 99, in flatten
   self._write(msg)
 File "/usr/local/lib/python3.2/email/generator.py", line 145, in _write
   self._dispatch(msg)
 File "/usr/local/lib/python3.2/email/generator.py", line 171, in _dispatch
   meth(msg)
 File "/usr/local/lib/python3.2/email/generator.py", line 232, in _handle_multipart
   g.flatten(part, unixfrom=False, linesep=self._NL)
 File "/usr/local/lib/python3.2/email/generator.py", line 99, in flatten
   self._write(msg)
 File "/usr/local/lib/python3.2/email/generator.py", line 152, in _write
   self._write_headers(msg)
 File "/usr/local/lib/python3.2/email/generator.py", line 373, in _write_headers
   for h, v in msg._headers:
ValueError: too many values to unpack (expected 2)
----
At least seems not to be compatible with my bugs. What am I doing wrong?
        https://www.chaos1.de/svn-public/repos/network-tools/ERDB/trunk/database/erdb_bt.py
Axel
---
PGP-Key:29E99DD6  ☀ +49 151 2300 9283  ☀ computing @ chaos claudius

_______________________________________________
Email-SIG mailing list
[hidden email]
Your options: http://mail.python.org/mailman/options/email-sig/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: email-6.0.0.a1

R. David Murray
On Sat, 30 Jul 2011 11:14:03 +0200, Axel Rau <[hidden email]> wrote:
> At least seems not to be compatible with my bugs. What am I doing wrong?
>         https://www.chaos1.de/svn-public/repos/network-
>  tools/ERDB/trunk/database/erdb_bt.py

There's nothing obvious wrong with your code in the vicinity of the error,
at a quick look.  Can you provide a copy of the email message that is
triggering this?  A copy of the .as_string output from your syslog would
probably be enough.

--
R. David Murray           http://www.bitdance.com
_______________________________________________
Email-SIG mailing list
[hidden email]
Your options: http://mail.python.org/mailman/options/email-sig/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Python-Dev] email-6.0.0.a1

R. David Murray
In reply to this post by R. David Murray
On Tue, 02 Aug 2011 18:48:11 +0100, Chris Withers <[hidden email]> wrote:

> On 19/07/2011 22:21, R. David Murray wrote:
> > The basic additional API is that a 'source' attribute contains the
> > text the generator read from the input source, and a 'value' attribute
> > that contains the value with all the Content-Transfer-Encoding stuff
> > undone so that you have a real unicode string.  By changing a policy
> > setting, you can have that value as the string value of the header.
> > You can also assign a string with non-ASCII characters to a header, and
> > the right thing will happen.  (Well, eventually it will happen...right
> > now it only works correctly for unstructured headers).  Further, Date
> > headers have a datetime attribute (and accept being set to a datetime),
> > and address headers have attributes for accessing the individual addresses
> > in the header.  Other structured headers will eventually grow additional
> > attributes as well.
>
> This all sounds pretty awesome, congrats :-)
>
> Has the header wrapping bug that was all part of the big headers mess
> been resolved now?

If it is the bug I think you are talking about, it was resolved in 3.2.1.
If there's still an open header wrapping bug (other than the one about
smime and spaces after the ':') please let me know the issue number,
as I don't see any in my list.

There may still be an issue with whitespace padding in the encoded
word context; I haven't tested issue 1467619 since I made my
other changes.  If it is not fixed in 3.2.1 already, it will be
fixed in email6 by the time I finish the new wrapping code for that.

--David
_______________________________________________
Email-SIG mailing list
[hidden email]
Your options: http://mail.python.org/mailman/options/email-sig/lists%40nabble.com
Loading...