Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: abp/filters/parser.py

Issue 29677724: Noissue - make parse_line and parse_filterlist also support byte strings (Closed)
Patch Set: Created Jan. 23, 2018, 4:30 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/test_parser.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: abp/filters/parser.py
===================================================================
--- a/abp/filters/parser.py
+++ b/abp/filters/parser.py
@@ -271,16 +271,19 @@
namedtuple
Parsed line (see `_line_type`).
Raises
------
ParseError
ParseError: If the line can't be parsed.
"""
+ if isinstance(line_text, type(b'')):
+ line_text = line_text.decode('utf-8')
+
content = line_text.strip()
if content == '':
line = EmptyLine()
elif content.startswith('!'):
line = _parse_comment(content)
elif content.startswith('%') and content.endswith('%'):
line = _parse_instruction(content)
« no previous file with comments | « no previous file | tests/test_parser.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld