Commit Graph

38 Commits

Author SHA1 Message Date
Christophe Matthieu 8460122209 [MERGE] sync with trunk
bzr revid: chm@openerp.com-20131202150856-fzrfcoa8pmsjutau
2013-12-02 16:08:56 +01:00
Xavier Morel 765429cfb0 [FIX] missing import lost during merge
bzr revid: xmo@openerp.com-20131127112908-ldwf1r1ypwx9pepx
2013-11-27 12:29:08 +01:00
Christophe Simonis 63601c6650 [FIX] html_sanitize does not raise exception for empty string anymore. correct related test
bzr revid: chs@openerp.com-20131125174956-1y13zszzf9h2pkl6
2013-11-25 18:49:56 +01:00
Xavier Morel 8e78b40e6a [MERGE] from trunk
bzr revid: xmo@openerp.com-20131115132553-9eqxggih8be63i36
2013-11-15 14:25:53 +01:00
Stephane Wirtel c9a7e69a75 [FIX] test_mail: Rewrite the XSS test
bzr revid: stw@openerp.com-20131107141019-jjhvism55j8x207g
2013-11-07 15:10:19 +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 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 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
Xavier Morel a4746b22c2 [FIX] disable test case crashing sanitizer
bzr revid: xmo@openerp.com-20130927130050-cgfs5g1kdnuge0b5
2013-09-27 15:00:50 +02:00
Thibault Delavallée e3175e482f [TESTS] tools: mail: added some tests + some cleaning in tests
bzr revid: tde@openerp.com-20130808132258-01sv0w1hrgtdyogq
2013-08-08 15:22:58 +02:00
Thibault Delavallée 4f7afae100 [MERGE] Sync with trunk
bzr revid: tde@openerp.com-20130717074450-puhtirdoqswf55pl
2013-07-17 09:44:50 +02:00
Olivier Dony e608027256 [FIX] openerp/tests/test_mail.py marked executable as it should
lp bug: https://launchpad.net/bugs/993414 fixed

bzr revid: odo@openerp.com-20130517102933-u1u4n2ad5jxnndw5
2013-05-17 12:29:33 +02:00
Thibault Delavallée ccbb8e09a6 [REF] html_email_clean: refactored the algorithm to clean it, specifically about truncature. Now add classes to node when not removing them, to be managed by the web client.
bzr revid: tde@openerp.com-20130425104301-e7mv9o4pcjx6k2cn
2013-04-25 12:43:01 +02:00
Thibault Delavallée f97bd8bd63 [REF] html_email_clean: refactoring of the algorithm, now better taking into account hotmail / msoffice emails. Added tests.
bzr revid: tde@openerp.com-20130423144903-he22jz9zs6nc6dsd
2013-04-23 16:49:03 +02:00
Christophe Matthieu 21c5425d89 [IMP] mail_sanitize: simplification of the regular expression
bzr revid: chm@openerp.com-20130102162544-jfwdfqx2ruf0x1q2
2013-01-02 17:25:44 +01:00
Christophe Matthieu 6a07b69889 [IMP] html_sanitize: test with assertIn
bzr revid: chm@openerp.com-20130102161458-4pvpvfb1shmt0sjy
2013-01-02 17:14:58 +01:00
Christophe Matthieu a4e7fa97f4 [IMP] mail sanitize: add special email address for escape in the sanitizer
bzr revid: chm@openerp.com-20130102090040-yh0vdv8b3mtwoebh
2013-01-02 10:00:40 +01:00
Christophe Matthieu 71a92f46e4 [FIX] tools: html_sanitize
bzr revid: chm@openerp.com-20121231154451-0guqjid92rfndghp
2012-12-31 16:44:51 +01:00
Thibault Delavallée be5118c704 [DOC] Added some comments. Updated failure message. Added a logging message when not capable of parsing.
bzr revid: tde@openerp.com-20121226164354-tjquf1zdyr90tl5e
2012-12-26 17:43:54 +01:00
Thibault Delavallée d7185be38c [IMP] html_sanitize: now uses the builtin cleaner of lxml.html. We also allows style attribute; the cleaner ensures no javascript or malicious code goes through those attributes. Updated and added tests for the sanitizer, especially about malicious code, and EDI-like html code.
bzr revid: tde@openerp.com-20121226162505-8rq060p375z1k9il
2012-12-26 17:25:05 +01:00
Christophe Matthieu bf11573436 [IMP] tools mail: encoding : add test for removing encoding attribute
bzr revid: chm@openerp.com-20121219143912-os160iv0q0jeyhld
2012-12-19 15:39:12 +01:00
Christophe Matthieu a31af13a3e [IMP] tools mail: add test message with xml and doctype tags don't crash
bzr revid: chm@openerp.com-20121219111853-zj16hdg7ujakksqt
2012-12-19 12:18:53 +01:00
Christophe Matthieu 50f09660fb [FIX] tools mail: html_email_clean return False (standard OpenERP) if the param is False
bzr revid: chm@openerp.com-20121120134001-ivw9dqxha2du70o6
2012-11-20 14:40:01 +01:00
Christophe Matthieu ceefb58670 [IMP] tools mail: remove one line test (double)
bzr revid: chm@openerp.com-20121120100225-it12j6qgxjn3ilbg
2012-11-20 11:02:25 +01:00
Christophe Matthieu f8a44b2bac [FIX] tools.mail: html_email_clean test type and value of empty value
bzr revid: chm@openerp.com-20121119152615-sazfnlc5uwiw0ut9
2012-11-19 16:26:15 +01:00
Christophe Matthieu a4b831e3ed [FIX] tools.mail: html_email_clean test type of empty value
bzr revid: chm@openerp.com-20121119152446-w1z1vuhfk631h0ko
2012-11-19 16:24:46 +01:00
Christophe Matthieu b4dc178588 [IMP] tools.mail: add a test for html_email_clean function, if empty string
bzr revid: chm@openerp.com-20121119151739-vcofz0abk7i71b3l
2012-11-19 16:17:39 +01:00
Thibault Delavallée f0569f7133 [MERGE] Tools: mail.py: (E)Mail management
Refactored a bit openerp/tools about (e)mails and html.
- moved some (e)mail related functions from misc to mail
- moved html_sanitizer into mail
- added html_email_clean, to clean incoming emails (remove quotes, signature)
- added a plaintext2html function, to convert plaintext into html (\n and \r are replaced by <br/>, more than two <br/> are replaced by end and beginning of paragraphs)
- append_content_to_html now uses plaintext2html, according to some new flags
- added tests for html_email_clean, plaintext2html, updated test for append_content_to_html, html_sanitize

bzr revid: tde@openerp.com-20121114150442-4rpfdy9spm1ig0qw
2012-11-14 16:04:42 +01:00
Thibault Delavallée 8e15ab0dff [FIX] Typo in tests.
bzr revid: tde@openerp.com-20121114135159-nouaj72drtot5hiv
2012-11-14 14:51:59 +01:00
Thibault Delavallée cbf3c82e88 [IMP] tools: added a true test for html_sanitize, some function renaming.
bzr revid: tde@openerp.com-20121114103849-hbxni04dpog1fxju
2012-11-14 11:38:49 +01:00
Thibault Delavallée 62c419e66f [IMP] tools: mail: improved append_content_to_html, including plaintext2html. Updated tests.
bzr revid: tde@openerp.com-20121109123521-e04g4zrhtv947l1r
2012-11-09 13:35:21 +01:00
Thibault Delavallée e6a9084677 [IMP] tools: added text2html function, basically turning plaintext into html. Added a test for this function. Updated signature for demo data.
bzr revid: tde@openerp.com-20121107164117-2caoqna2aclzowpk
2012-11-07 17:41:17 +01:00
Thibault Delavallée 4d89845de6 [IMP] tools: tests: cleaner: cleaned a bit test data. Will have to be improved.
bzr revid: tde@openerp.com-20121107093201-s0pco15msilt4erz
2012-11-07 10:32:01 +01:00
Thibault Delavallée 56b0b518a2 [IMP] tests: moved append_to_html into right test file. Added basic struct and templates for testing html_email_clean.
bzr revid: tde@openerp.com-20121106121824-wb8qf9snma7qffqe
2012-11-06 13:18:24 +01:00
Thibault Delavallée 207675a174 [REN] html_sanitize -> mail, to have a central file for methods about mail (html sanitizing, html management, emails related functions, ...).
bzr revid: tde@openerp.com-20121106115420-1h8mvzohol9zjysa
2012-11-06 12:54:20 +01:00