[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:
+10
-2
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user