[FIX] mail sanitize: allow extra common style attributes

Without allowing these harmless style attributes, sending
mass mailing emails with the new snippets produced an ugly
dumbed-down version.
This commit is contained in:
Olivier Dony
2017-03-07 16:04:33 +01:00
parent 58593c2755
commit a7ff8364ea
+10 -2
View File
@@ -42,14 +42,22 @@ class _Cleaner(clean.Cleaner):
_style_re = re.compile('''([\w-]+)\s*:\s*((?:[^;"']|"[^"]*"|'[^']*')+)''')
_style_whitelist = [
'font-size', 'font-family', 'background-color', 'color', 'text-align',
'font-size', 'font-family', 'font-weight', 'background-color', 'color', 'text-align',
'line-height', 'letter-spacing', 'text-transform', 'text-decoration',
'padding', 'padding-top', 'padding-left', 'padding-bottom', 'padding-right',
'margin', 'margin-top', 'margin-left', 'margin-bottom', 'margin-right'
# box model
'border', 'border-color', 'border-radius', 'height', 'margin', 'padding', 'width', 'max-width', 'min-width',
'border', 'border-color', 'border-radius', 'border-style', 'height',
'margin', 'padding', 'width', 'max-width', 'min-width',
# tables
'border-collapse', 'border-spacing', 'caption-side', 'empty-cells', 'table-layout']
_style_whitelist.extend(
['border-%s-%s' % (position, attribute)
for position in ['top', 'bottom', 'left', 'right']
for attribute in ('style', 'color', 'width', 'left-radius', 'right-radius')]
)
strip_classes = False
sanitize_style = False