[FIX] fields: do not strip class by default

Do not strip class by default on html fields, this was an error. Currently
only mail_message body field should not contain classes. Indeed as external
content can be stored through the mail gateway we do not want to keep the
classes.
This commit is contained in:
Thibault Delavallée
2016-03-02 16:43:04 +01:00
parent cf2318a76d
commit fd25fd4d44
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -49,7 +49,7 @@ class Message(models.Model):
# content
subject = fields.Char('Subject')
date = fields.Datetime('Date', default=fields.Datetime.now)
body = fields.Html('Contents', default='')
body = fields.Html('Contents', default='', strip_classes=True)
attachment_ids = fields.Many2many(
'ir.attachment', 'message_attachment_rel',
'message_id', 'attachment_id',
+1 -1
View File
@@ -1273,7 +1273,7 @@ class Html(_String):
_slots = {
'sanitize': True, # whether value must be sanitized
'strip_style': False, # whether to strip style attributes (otherwise: sanitized)
'strip_classes': True, # whether to strip classes attributes
'strip_classes': False, # whether to strip classes attributes
}
def _setup_attrs(self, model, name):
+1 -1
View File
@@ -352,7 +352,7 @@ class html(text):
return value
return html_sanitize(value, silent=True, strict=True, strip_style=self._strip_style, strip_classes=self._strip_classes)
def __init__(self, string='unknown', sanitize=True, strip_style=False, strip_classes=True, **args):
def __init__(self, string='unknown', sanitize=True, strip_style=False, strip_classes=False, **args):
super(html, self).__init__(string=string, **args)
self._sanitize = sanitize
self._strip_style = strip_style