This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author stephenemslie
Recipients stephenemslie
Date 2008-01-24.15:43:58
SpamBayes Score 0.006048358
Marked as misclassified No
Message-id <1201189441.64.0.266619284042.issue1923@psf.upfronthosting.co.za>
In-reply-to
Content
distutils.util.rfc822_escape strips each line of its whitespace before
indenting, but this can mean losing meaningful whitespace, such as in
reStructuredText.


distutils uses rfc822_escape to escape fields in metadata, such as
PKG-INFO. 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.).

for example:

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

       a literal python block::
       >>> import this

I would be expecting this to look something like:

       a literal python block::
           >>> import this


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.

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.

http://www.w3.org/Protocols/rfc822/3_Lexical.html
History
Date User Action Args
2008-01-24 15:44:01stephenemsliesetspambayes_score: 0.00604836 -> 0.006048358
recipients: + stephenemslie
2008-01-24 15:44:01stephenemsliesetspambayes_score: 0.00604836 -> 0.00604836
messageid: <1201189441.64.0.266619284042.issue1923@psf.upfronthosting.co.za>
2008-01-24 15:43:59stephenemslielinkissue1923 messages
2008-01-24 15:43:58stephenemsliecreate