File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 11try :
22 from itertools import filterfalse as ifilterfalse
3+ from cStringIO import StringIO
34except ImportError :
45 from itertools import ifilterfalse
6+ from io import StringIO
57import re
68from rtkit import comment
79
@@ -112,8 +114,11 @@ def build(cls, body):
112114 """
113115 def build_section (section ):
114116 logic_lines = []
115- for line in filter (None , section .splitlines ()):
116- if cls .HEADER .match (line ):
117+ for line in StringIO (section ):
118+ # strip trailing newline
119+ if line and line [- 1 ] == '\n ' :
120+ line = line .rstrip ('\n ' )
121+ if not line or cls .HEADER .match (line ):
117122 continue
118123 if line [0 ].isspace ():
119124 logic_lines [- 1 ] += '\n ' + line .strip (' ' )
Original file line number Diff line number Diff line change @@ -29,3 +29,12 @@ def test_parse_kw_syntax_err(self):
2929'''
3030 parsed = RTParser .parse (body , RTParser .decode_comment )
3131 self .assertEqual (parsed , [[('queue' , 'You may not create requests in that queue.' )]])
32+
33+ def test_vertical_tab (self ):
34+ body = '''RT/3.8.7 200 Ok
35+ Field: first line
36+ second\v line
37+ third line
38+ '''
39+ parsed = RTParser .parse (body , RTParser .decode )
40+ self .assertEqual (parsed , [[('Field' , 'first line\n second\x0b line\n third line' )]])
You can’t perform that action at this time.
0 commit comments