File tree 2 files changed +9
-2
lines changed
2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 9
9
class RawPolicy (email .policy .EmailPolicy ):
10
10
def fold (self , name , value ):
11
11
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 ()
13
15
)
14
16
return f'{ name } : { folded } { self .linesep } '
15
17
@@ -29,10 +31,12 @@ class Message(email.message.Message):
29
31
... <BLANKLINE>
30
32
... First line of description.
31
33
... Second line of description.
34
+ ... <BLANKLINE>
35
+ ... Fourth line!
32
36
... ''').lstrip().replace('<BLANKLINE>', '')
33
37
>>> msg = Message(email.message_from_string(msg_text))
34
38
>>> 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 '
36
40
37
41
Message should render even if values contain newlines.
38
42
@@ -43,6 +47,8 @@ class Message(email.message.Message):
43
47
de-blah
44
48
Description: First line of description.
45
49
Second line of description.
50
+ <BLANKLINE>
51
+ Fourth line!
46
52
<BLANKLINE>
47
53
<BLANKLINE>
48
54
"""
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