[Python-Dev] rfc822_escape doing the right thing? (original) (raw)

stephen emslie stephenemslie at gmail.com
Wed Jan 23 17:38:12 CET 2008


I've been working on a project that renders PKG-INFO metadata in a number of ways. I have noticed that fields with any indentation were flattened out, which is being done in distutils.util.rfc822_escape. This unfortunately means that you cant use reStructuredText formatting in your long description (suggested in PEP345), or are limited to a set that doesn't require indentation (no block quotes, etc.).

It looks like this behavior was intentionally added in rev 20099, but that was about 7 years ago - before reStructuredText and eggs. I wonder if it makes sense to re-think that implementation with this sort of metadata in mind, assuming this behavior isn't required to be rfc822 compliant. I think it would certainly be a shame to miss out on a good thing like proper (renderable) reST in our metadata.

A quick example of what I mean:

rest = """ ... a literal python block:: ... >>> import this ... """ print distutils.util.rfc822escape(rest)

    a literal python block::
    >>> import this

should look something like:

    a literal python block::
        >>> import this

Is distutils being over-cautious in flattening out all whitespace? A w3c discussion on multiple lines in rfc822 [1] seems to suggest that whitespace can be 'unfolded' safely, so it seems a shame to be throwing it away when it can have important meaning.

[1] http://www.w3.org/Protocols/rfc822/3_Lexical.html

Thanks for any comments

Stephen Emslie



More information about the Python-Dev mailing list