[Python-Dev] Edits to Metadata 1.2 to add extras (optional ependencies)

R. David Murray rdmurray at bitdance.com
Fri Aug 31 18:53:27 CEST 2012


On Fri, 31 Aug 2012 12:18:05 -0400, Daniel Holth <dholth at gmail.com> wrote:
> Some edits to include / and remove rfc822 again. What is the right
> email.policy.Policy()?

When I discussed using email to parse metadata with Tarek a long time
ago, I thought he was going to move to using a delimiter-substitution
algorithm to encode and recover the line breaks.  Perhaps that discussion
wasn't in this same context, but I thought it was.  If you did that,
then 'SMTP' would be the correct policy for RFC2822/5322.

But that isn't really going to work for this use case, even with the above
hack.  As Martin pointed out, RFC2822 does not allow utf-8 in the values.

RFC 5335, which is Experimental, does.  A medium term goal of the email
package is to support that RFC, so this might be a motivation to move that
higher in my feature priority list.  (Support mostly involves switches
to allow unicode/utf8 to be *written*; the parsing side works already,
though it is not thoroughly tested.)

However, all that aside, to answer your question you are really going to
want to define a custom policy that derives from email.policy.Policy.
Especially if you want to not follow the email RFCs and do want to
assign meaning to the line separators.  You can do that with a custom
policy and thus still be able the use the email parsing infrastructure
to read and write the files.  I'll be glad to help out with creating
the custom policy once we've reached that stage of the process.

--
R. David Murray

If you like the work I do for Python, you can enable me to spend more
time doing it by supporting me here:  http://gittip.com/bitdancer


More information about the Python-Dev mailing list