| 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))) |