File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 99class RawPolicy (email .policy .EmailPolicy ):
1010 def fold (self , name , value ):
1111 folded = self .linesep .join (
12- textwrap .indent (value , prefix = ' ' * 8 ).lstrip ().splitlines ()
12+ textwrap .indent (value , prefix = ' ' * 8 , predicate = lambda line : True )
13+ .lstrip ()
14+ .splitlines ()
1315 )
1416 return f'{ name } : { folded } { self .linesep } '
1517
@@ -29,10 +31,12 @@ class Message(email.message.Message):
2931 ... <BLANKLINE>
3032 ... First line of description.
3133 ... Second line of description.
34+ ... <BLANKLINE>
35+ ... Fourth line!
3236 ... ''').lstrip().replace('<BLANKLINE>', '')
3337 >>> msg = Message(email.message_from_string(msg_text))
3438 >>> msg['Description']
35- 'First line of description.\nSecond line of description.\n'
39+ 'First line of description.\nSecond line of description.\n\nFourth line!\n '
3640
3741 Message should render even if values contain newlines.
3842
@@ -43,6 +47,8 @@ class Message(email.message.Message):
4347 de-blah
4448 Description: First line of description.
4549 Second line of description.
50+ <BLANKLINE>
51+ Fourth line!
4652 <BLANKLINE>
4753 <BLANKLINE>
4854 """
Original file line number Diff line number Diff line change 1+ Fixed indentation logic to also honor blank lines.
You can’t perform that action at this time.
0 commit comments