| Index: cms/converters.py |
| =================================================================== |
| --- a/cms/converters.py |
| +++ b/cms/converters.py |
| @@ -176,30 +176,30 @@ |
| # Insert fixed strings |
| for i, fixed_string in enumerate(fixed_strings, 1): |
| result = result.replace('{{{}}}'.format(i), fixed_string) |
| # Insert attributes |
| result = escape(result) |
| - def stringify_attribute((name, value)): |
| + def stringify_attribute(name, value): |
| return '{}="{}"'.format( |
| escape(name), |
| escape(self.insert_localized_strings(value, {})) |
| ) |
| for tag in self.whitelist: |
| allowed_contents = '(?:[^<>]|{})'.format('|'.join( |
| '<(?:{}[^<>]*?|/{})>'.format(t, t) |
| for t in map(re.escape, self.whitelist - {tag}) |
| )) |
| saved = saved_attributes.get(tag, []) |
| for attrs in saved: |
| - attrs = map(stringify_attribute, attrs) |
| + attrs = [stringify_attribute(*attr) for attr in attrs] |
| result = re.sub( |
| r'{}({}*?){}'.format(re_escape('<{}>'.format(tag)), |
| allowed_contents, |
| re_escape('</{}>'.format(tag))), |
| lambda match: r'<{}{}>{}</{}>'.format( |
| tag, |
| ' ' + ' '.join(attrs) if attrs else '', |
| match.group(1), |