Merge lp:~openerp-dev/openobject-server/saas-3-opw-605315-acl into lp:~openerp/openobject-server/saas-3

Proposed by Anaël Closson (openerp)
Status: Merged
Merged at revision: 5117
Proposed branch: lp:~openerp-dev/openobject-server/saas-3-opw-605315-acl
Merge into: lp:~openerp/openobject-server/saas-3
Diff against target: 43 lines (+8/-2)
1 file modified
openerp/tools/mail.py (+8/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-server/saas-3-opw-605315-acl
Reviewer Review Type Date Requested Status
Martin Trigaux (OpenERP) (community) Approve
Review via email: mp+215889@code.launchpad.net

Description of the change

The html editor modifies mako instruction not inside html tags.
This keep modifies html sanitisation so that
 - comments are kept in the sanitisation process
 - they are considered as inside html tags by the html editor, hence not modified

This is particularly needed when a template generates rows in a html table, the processing instructions should be added around "<tr></tr>". Any modifications in the template before sending the e-mail break it.

To post a comment you must log in.
Revision history for this message
Martin Trigaux (OpenERP) (mat-openerp) wrote :

LGMT, merged in saas-3

revno: 5117 [merge]
revision-id: <email address hidden>

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'openerp/tools/mail.py'
--- openerp/tools/mail.py 2014-02-19 14:06:17 +0000
+++ openerp/tools/mail.py 2014-04-15 14:45:57 +0000
@@ -45,7 +45,7 @@
45tags_to_remove = ['html', 'body', 'font']45tags_to_remove = ['html', 'body', 'font']
4646
47# allow new semantic HTML5 tags47# allow new semantic HTML5 tags
48allowed_tags = clean.defs.tags | frozenset('article section header footer hgroup nav aside figure main'.split())48allowed_tags = clean.defs.tags | frozenset('article section header footer hgroup nav aside figure main'.split() + [etree.Comment])
49safe_attrs = clean.defs.safe_attrs | frozenset(49safe_attrs = clean.defs.safe_attrs | frozenset(
50 ['style',50 ['style',
51 'data-oe-model', 'data-oe-id', 'data-oe-field', 'data-oe-type', 'data-oe-expression', 'data-oe-translate', 'data-oe-nodeid',51 'data-oe-model', 'data-oe-id', 'data-oe-field', 'data-oe-type', 'data-oe-expression', 'data-oe-translate', 'data-oe-nodeid',
@@ -70,6 +70,8 @@
70 'forms': True, # remove form tags70 'forms': True, # remove form tags
71 'remove_unknown_tags': False,71 'remove_unknown_tags': False,
72 'allow_tags': allowed_tags,72 'allow_tags': allowed_tags,
73 'comments': False,
74 'processing_instructions' : False
73 }75 }
74 if etree.LXML_VERSION >= (2, 3, 1):76 if etree.LXML_VERSION >= (2, 3, 1):
75 # kill_tags attribute has been added in version 2.3.177 # kill_tags attribute has been added in version 2.3.1
@@ -339,10 +341,14 @@
339 overlength_section_count = 0341 overlength_section_count = 0
340 cur_char_nbr = 0342 cur_char_nbr = 0
341 for node in root.iter():343 for node in root.iter():
344 # comments do not need processing
345 if node.tag == etree.Comment:
346 continue
342 # do not take into account multiple spaces that are displayed as max 1 space in html347 # do not take into account multiple spaces that are displayed as max 1 space in html
343 node_text = ' '.join((node.text and node.text.strip(' \t\r\n') or '').split())348 node_text = ' '.join((node.text and node.text.strip(' \t\r\n') or '').split())
344349
345 # root: try to tag the client used to write the html350 # root: try to tag the client used to write the html
351 # note: bug in node.get(value, default) for HtmlComments, default never returned
346 if 'WordSection1' in node.get('class', '') or 'MsoNormal' in node.get('class', ''):352 if 'WordSection1' in node.get('class', '') or 'MsoNormal' in node.get('class', ''):
347 root.set('msoffice', '1')353 root.set('msoffice', '1')
348 if 'SkyDrivePlaceholder' in node.get('class', '') or 'SkyDrivePlaceholder' in node.get('id', ''):354 if 'SkyDrivePlaceholder' in node.get('class', '') or 'SkyDrivePlaceholder' in node.get('id', ''):
@@ -657,4 +663,4 @@
657 # sometimes returns emails without at least '@'. The '@'663 # sometimes returns emails without at least '@'. The '@'
658 # is strictly required in RFC2822's `addr-spec`.664 # is strictly required in RFC2822's `addr-spec`.
659 if addr[1]665 if addr[1]
660 if '@' in addr[1]]
661\ No newline at end of file666\ No newline at end of file
667 if '@' in addr[1]]

Subscribers

People subscribed via source and target branches