Commit Graph

92 Commits

Author SHA1 Message Date
Christophe Simonis 47b2f7ea9e [MERGE] forward port of branch 7.0 up to 3a1c693 2015-12-08 12:16:00 +01:00
Denis Ledoux 31e8bb8e9d [FIX] mail: better signature detection
This revision back-ports revisions
983d5eb9fa
&
ccbb8e09a6
regarding this signature regex.

Besides, it adds the fact the dashes have to
be at the beginning of the line
to make them detected as a signature.

opw-655834
2015-11-30 14:48:59 +01:00
Olivier Dony edd94b623e [MERGE] Forward-port 7.0 up to 1b49a87 2014-10-10 19:21:18 +02:00
Martin Trigaux bd52298073 [IMP] mail: parsing emails with several html parts
If an email contains several text/html parts inside a multipart email, the previous code was only keeping the last content part.
The Content-Type: multipart/mixed allows several independent part (RFC1341 7.2.2), so two html is technically valid.
With this patch, the two parts are concatenated. (opw 614755)

Modify append_content_to_html regex to make sure the regex keeps the content of the html instead of removing it.
e.g.: "123 <html> 456 </html> 789" used to be stripped to "123  789" while we expect "123 456 789"
2014-10-09 13:53:23 +02:00
Denis Ledoux e447a46ec8 [MERGE] forward port of branch 7.0 up to 33e0910 2014-09-09 18:02:30 +02:00
Denis Ledoux d824769b3c [FIX] tools,mail: improve parsing of references from rev. 0bee015dd6
Backport of 8.0 fix was not enough for 7.0, because it still fails for the legacy reference match (model+res_id), which is not used in 8.0
2014-09-05 11:44:20 +02:00
Martin Trigaux 7bcefaf232 Forward port of branch 7.0 up to 0ab88f5 2014-08-21 17:57:57 +02:00
Desai Binjal 8fe9f07cac [FIX] note: small bugs 2014-08-21 15:55:23 +02:00
Christophe Simonis 24484c8bcd [MERGE] forward port of branch 7.0 up to 7a928b1 2014-07-15 10:36:54 +02:00
Thibault Delavallée 7a928b151a [FIX] tools: mail: fixed last commit, solving an issue with the html2plaintext introduced another issue with notes. Reverting to the first version. 2014-07-11 16:21:01 +02:00
Olivier Dony a9d2b65da5 [MERGE] Fwd-port 7.0 up to 783b9e1 2014-07-11 11:51:06 +02:00
Anand-Dharampuriya 5cbc611361 [FIX] Solve some mail issues which are currently present in 7.0 2014-07-10 16:29:54 +02:00
Martin Trigaux 901bb47235 [MERGE] [IMP] mail sanitizer: do not remove comments in html body when cleaning (and do not remove too many content) (opw 605315)
bzr revid: mat@openerp.com-20140423131919-q3vbw12tokglwdsq
2014-04-23 15:19:19 +02:00
Anael Closson 1528f9273b [FIX] tools: Comments in e-mail templates are removed before mako/jinja2 processing - opw 605315
bzr revid: acl@openerp.com-20140415143736-bcgwgribsv2hsbvo
2014-04-15 16:37:36 +02:00
Martin Trigaux e328c0a40e [FIX] html_sanitize: partial backport of trunk revision 5047.
Unescape elements that have been wrongly escaped.

Some elements (eg: 'href' tag in links) are sanitised in templates which prevents the execution of mako templates.

lp bug: https://launchpad.net/bugs/1273251 fixed

bzr revid: mat@openerp.com-20140210144023-9sp8cqn07ta5o64y
2014-02-10 15:40:23 +01:00
Thibault Delavallée 2bcf4cca79 [FIX] tools: mail: support \[ and \] in tmeplates
bzr revid: tde@openerp.com-20140123152842-21b3gsey1mxt4v37
2014-01-23 16:28:42 +01:00
Thibault Delavallée 69af79ff3d [FIX] tools: mail: fixed last commit, now simply using replace
bzr revid: tde@openerp.com-20140123141435-jstfcaemjplbn7b1
2014-01-23 15:14:35 +01:00
Thibault Delavallée 5f1ec49ecd [FIX] tools: mail: when cleaning, unescape mako specific symbols.
Indeed those are escaped when contained inside an href or mailto element
of a tag, leading to mako not rendering the element.

bzr revid: tde@openerp.com-20140123125137-4u4i88f1ajybg5f2
2014-01-23 13:51:37 +01:00
Thibault Delavallée ab5c23079a [MERGE] Sync with trunk, solved conflicts.
bzr revid: tde@openerp.com-20140116091716-zk1n5ots94i65io5
2014-01-16 10:17:16 +01:00
Christophe Simonis a69f789b41 [MERGE] forward port of branch 7.0 up to revid 5224 chs@openerp.com-20140206105141-7e8bv8ordqqsswh7
bzr revid: dle@openerp.com-20140205105045-j95kduyjiq83e57z
bzr revid: dle@openerp.com-20140114173613-ruxye1m7fxtcjfim
bzr revid: dle@openerp.com-20140116161158-u95vcs3os4tk2zob
bzr revid: dle@openerp.com-20140121172737-gzawfi3ssg7xifef
bzr revid: chs@openerp.com-20140129094554-c3abc8x3qz9mpszr
bzr revid: chs@openerp.com-20140129140159-9vwkpr078shoonum
bzr revid: chs@openerp.com-20140206110220-myn57cryam1y4k9v
2014-02-06 12:02:20 +01:00
Thibault Delavallée c63ffed24d [IMP] tools: mail: the cleaner, by parsing and serializing the html content,
encapsulatse the whole content inside a div. This means that html fields are
not editor-clean after being sanitized, because a div has been inserted as root
element. Removing this element allows to have snippets that can be dragged,
dropped, or to insert new snippets inside edited html content in html fields.

[IMP] tools: tests: mail: updated a test accordingly

bzr revid: tde@openerp.com-20140115142709-e4951b4nc06sfxf0
2014-01-15 15:27:09 +01:00
Thibault Delavallée 2c4600f242 [IMP] [READD] [IMP] tools: mail: have a strict mode for html_sanitizer (not default) with
options before website: without frames, with safe attributes only.
We will have to find a way to use the strict mode when parsing incoming
emails, but not when sending or storing openerp content.

Currently the not strict mode is the default one, to avoid side-effects with
the website.

bzr revid: tde@openerp.com-20140115141319-g15zl1kqrp8sgoa3
2014-01-15 15:13:19 +01:00
Olivier Dony 7a819ca8d0 [FIX] tools.email_split: improve email extraction using stdlib + extra tests
The original code was having issues telling apart
names containing emails from the actual email.
This patch is inspired by Etienne Hirt's patch
on bug 1165531 for OpenERP 6.1.
This will also help solve bug 1199386, if we can
centralize all email parsing through this helper.

lp bug: https://launchpad.net/bugs/1199386 fixed
lp bug: https://launchpad.net/bugs/1165531 fixed

bzr revid: odo@openerp.com-20140114154426-usu6intv5139egd3
2014-01-14 16:44:26 +01:00
Thibault Delavallée fe0af74eab [REV] Reverted last commit.
bzr revid: tde@openerp.com-20140113165423-8nu3838d4yj3h3j4
2014-01-13 17:54:23 +01:00
Thibault Delavallée 94357739bc [IMP] tools: mail: have a strict mode for html_sanitizer (not default) with
options before website: without frames, with safe attributes only.
We will have to find a way to use the strict mode when parsing incoming
emails, but not when sending or storing openerp content.

Currently the not strict mode is the default one, to avoid side-effects with
the website.

bzr revid: tde@openerp.com-20140113085701-f2bzu94cq1z3tl10
2014-01-13 09:57:01 +01:00
Fabien Pinckaers f9e986ecea [IMP] allow frames in blogs (video, ...
bzr revid: fp@tinyerp.com-20131214211309-i2kk3cb60hnp1urz
2013-12-14 22:13:09 +01:00
Fabien Pinckaers 65a5ce8a92 [IMP] HMTL5 main element
bzr revid: fp@tinyerp.com-20131213214157-8ow63hpaii6hdvxl
2013-12-13 22:41:57 +01:00
Fabien Pinckaers 630e9ad64c [FIX] Don't remove data-... attributes like data-snippet-id
bzr revid: fp@tinyerp.com-20131209185406-newaf16v532l146p
2013-12-09 19:54:06 +01:00
Christophe Matthieu 8460122209 [MERGE] sync with trunk
bzr revid: chm@openerp.com-20131202150856-fzrfcoa8pmsjutau
2013-12-02 16:08:56 +01:00
Denis Ledoux 6fd552c3ce [MERGE] Forward-port of latest 7.0 bugfixes, up to rev. 5139 rev-id: dle@openerp.com-20131121132305-qjlclgz5v9tze1fr
bzr revid: odo@openerp.com-20131120102545-2tlp031yib6viz35
bzr revid: chs@openerp.com-20131120161708-c8sbom592moukwxw
bzr revid: dle@openerp.com-20131121155457-lh7fzouk2upeiu16
2013-11-21 16:54:57 +01:00
Christophe Simonis 7ba1d747cc [FIX] html_sanitize: handle the case of empty documents (after sanitization).
[IMP] test_mail: do not mute logger

bzr revid: chs@openerp.com-20131113113715-tzaog0d6o2u4q0x4
2013-11-13 12:37:15 +01:00
Thibault Delavallée 97f164ba99 [MERGE] Sync with trunk
bzr revid: tde@openerp.com-20131028163325-2hpks3hp23zop40n
2013-10-28 17:33:25 +01:00
Thibault Delavallée 357676b6de [MERGE] [FIX] tools: mail: fixed shortening of html content.
Fixed length computation of text in html nodes: multiples successive whitespaces are considered as one whitespaces; better truncate position when adding a read more link; now always protect words (placed after the first word that exceeds the shorten position); pre nodes are preserved about whitespaces; when the read more link should go into a quote, it instead goes at the end of the first parent node not being quoted instead of at a wrong position.

Misc :
- removed an unnecessary loop by merging two root.iter() that do not interfere
- changed occurrences of getiterator to iter, because getiterator is deprecated
- nodes are cleaned after processing, removing all attributes used to tag nodes
- fixed a bug about cleaning span containing only whitespaces not always cleaned

Added tests for shorten position.

bzr revid: tde@openerp.com-20131024084411-pytwt9g1gdmoebzc
2013-10-24 10:44:11 +02:00
Thibault Delavallée dbe253b0e4 [FIX] Fixed bug due to copy-and-paste: outertext is now valid
bzr revid: tde@openerp.com-20131024083955-ipbsf8rxbzm0mag3
2013-10-24 10:39:55 +02:00
Thibault Delavallée e14de7a637 [FIX] Fixed previous commit, car go to len of the string.
bzr revid: tde@openerp.com-20131023123839-gvf9ugft2b2xmo9a
2013-10-23 14:38:39 +02:00
Thibault Delavallée 7f61d18ef9 [CLEAN] tools: cleaned modified code
bzr revid: tde@openerp.com-20131023122744-3b3hayy4f8ss2bjx
2013-10-23 14:27:44 +02:00
Thibault Delavallée 57c11338ae [IMP] tools: mail: added a protection in a string.find, could have a None argument
bzr revid: tde@openerp.com-20131022142908-sol44xaprx1b0b0a
2013-10-22 16:29:08 +02:00
Thibault Delavallée af29bf7bc9 [FIX] tools: mail: fixed shortening of html content.
Fixed length computation of text in html nodes: multiples successive
whitespaces are considered as one whitespaces; better truncate position
when adding a read more link; now always protect words (placed after
the first word that exceeds the shorten position); pre nodes are preserved
about whitespaces; when the read more link should go into a quote, it instead
goes at the end of the first parent node not being quoted instead of at
a wrong position.

Added tests for shorten position.

bzr revid: tde@openerp.com-20131022135037-igauu2kkglvdrqu7
2013-10-22 15:50:37 +02:00
Olivier Dony 71f1665b98 [FIX] tools.mail: typo causing infinite loop + fix test parameters to actually enter it
bzr revid: odo@openerp.com-20131018085118-9b2ltkpff5c8yzmr
2013-10-18 10:51:18 +02:00
Thibault Delavallée 6bc32a8b4b [FIX] tools: mail: fixed / improved html_email_clean.
Read more links could not appear when the shorten limit was obtained
inside a quote that is removed in the process, removing the read
more link node. It now get the first parent that is not inside a
quote to be sure the link is displayed.

Added the test-case that helped find this bug.

bzr revid: tde@openerp.com-20131017110525-etn0u5s91zbnvul1
2013-10-17 13:05:25 +02:00
Thibault Delavallée 983d5eb9fa [FIX] tools: html_email_clean: fixed regex for
signature that was buggy when having dots.
Also fixed read more link addition.

Added test case that triggered the error.

bzr revid: tde@openerp.com-20131016103516-w44j6r5oaljpwvmx
2013-10-16 12:35:16 +02:00
Thibault Delavallée 54933118a4 [MERGE] Sync with trunk until revision 4957.
bzr revid: tde@openerp.com-20131002133820-8xomdumexexqp3pk
2013-10-02 15:38:20 +02:00
Thibault Delavallée 6069810f03 [IMP] tools: improved html_email_clean.
It can now take into account sections, and protect them. This allows to display a read more link
after a whole section. This will be used in the website, to display the first section of blogs for
example.

Also added some options on the read more link, allowing to tune its tag, content, as well as the link.

Also improved html_sanitize, taking improvements from the trunk branch of server, waiting for the whole
trunk branch to be merged.

bzr revid: tde@openerp.com-20131001142151-rt1g6zpxozd1eau2
2013-10-01 16:21:51 +02:00
Fabien Pinckaers 81b28ae22d [IMP] read more new line
bzr revid: fp@tinyerp.com-20130930075727-uoxqbloao2mbyw6t
2013-09-30 09:57:27 +02:00
Thibault Delavallée be966b02c7 [IMP] tools: mail: improved html_email_clean
- 'read more' links are now in the last container, not after, allowing to have read more
links embedded inside shortened paragraphs
- added expand_options dict allowing to customize the read more

bzr revid: tde@openerp.com-20130923112939-0ab4idlzqpug00xz
2013-09-23 13:29:39 +02:00
Thibault Delavallée 8583ced4cc [MERGE] Sync with trunk
bzr revid: tde@openerp.com-20130910151742-rgmc2jwx6zyg38lp
bzr revid: tde@openerp.com-20130912073916-1ph4x7cw6oovdafl
bzr revid: tde@openerp.com-20130916092207-5rqco7ua9tbd1cvh
2013-09-16 11:22:07 +02:00
Christophe Simonis 4327e09a55 [MERGE] forward port of branch saas-1 up to revid 4903 dle@openerp.com-20130909170248-a4t5y6qd5ikkhhac
bzr revid: chs@openerp.com-20130910121230-xcr2yj6rpbo83wy0
2013-09-10 14:12:30 +02:00
Thibault Delavallée 43dc750917 [MERGE] Sync with trunk
bzr revid: tde@openerp.com-20130826085405-04kpm11rfz9m6zgk
bzr revid: tde@openerp.com-20130902142029-8u7esi4j51g8xguj
bzr revid: tde@openerp.com-20130906081619-m84142whjfs2zbdg
bzr revid: tde@openerp.com-20130909093131-rnj42h1tu7s5akt2
2013-09-09 11:31:31 +02:00
Xavier Morel 945376a066 [FIX] no Logger.getChild in Python 2.6
bzr revid: xmo@openerp.com-20130906135331-zt3uzoeupvlba513
2013-09-06 15:53:31 +02:00
Christophe Simonis b5f38f8b7d [FIX] html_sanitize: allow new semantic HTML5 tags
bzr revid: chs@openerp.com-20130830093253-o6lcg432wrt63ftt
2013-08-30 11:32:53 +02:00