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

Unified Diff: abp/filters/rpy.py

Issue 29880577: Issue 6877 - Only parse headers in the first line of the filter list (Closed)
Patch Set: Initial Created Sept. 14, 2018, 4:43 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
Index: abp/filters/rpy.py
===================================================================
--- a/abp/filters/rpy.py
+++ b/abp/filters/rpy.py
@@ -67,27 +67,29 @@
if isinstance(data, tuple):
return tuple(strings2utf8(v) for v in data)
if isinstance(data, type('')): # Python 2/3 compatible way of
# saying "unicode string".
return data.encode('utf-8')
return data
-def line2dict(text):
+def line2dict(text, mode='body'):
"""Convert a filterlist line to a dictionary.
All strings in the output dictionary will be UTF8 byte strings. This is
necessary to prevent unicode encoding errors in rPython conversion layer.
Parameters
----------
text: str
The filter text we want to parse
+ mode: str
+ Parsing mode (see `abp.filters.parser.parse_line`).
Returns
-------
dict
With the parsing results and all strings converted to utf8 byte
strings.
"""
- return strings2utf8(tuple2dict(parse_line(text)))
+ return strings2utf8(tuple2dict(parse_line(text, mode)))
« abp/filters/parser.py ('K') | « abp/filters/parser.py ('k') | tests/test_parser.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld