Commit Graph

109 Commits

Author SHA1 Message Date
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
Xavier Morel e692f8b2be [FIX] Logger.getChild(suffix) — New in version 2.7.
bzr revid: xmo@openerp.com-20130829101715-vn8zn7cxntdgtleg
2013-08-29 12:17:15 +02:00
Christophe Simonis 208b697239 [MERGE] forward port of branch saas-1 up to revid 4899 chs@openerp.com-20130821094758-1ae0d1ml5obufzxv
bzr revid: odo@openerp.com-20130820160346-qcdy4kavgm5cb9t6
bzr revid: chs@openerp.com-20130821103139-zqqbrt8dq6iixrny
2013-08-21 12:31:39 +02:00
Christophe Simonis 8179683143 [IMP] html_sanitize:
- add option to reraise catched exceptions
 - only keep safe attributes (style is considered safe) (depending of lxml version)
 - remove forms tags

bzr revid: chs@openerp.com-20130821094758-1ae0d1ml5obufzxv
2013-08-21 11:47:58 +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 d1e7ad9be6 [IMP] tools: added a regex for bounce email addresses
bzr revid: tde@openerp.com-20130806151018-0uom07dbr8b7ycb3
2013-08-06 17:10:18 +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 78ac31e260 [IMP] html_email_clean: now handles maximum character number truncature.
bzr revid: tde@openerp.com-20130423153727-tv0neudvlalaepu2
2013-04-23 17:37:27 +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
Vo Minh Thu 307ca374d6 [MERGE] forward merge 7.0 until revision 4919.
bzr revid: vmt@openerp.com-20130404130704-24vsmczw34cssytd
2013-04-04 15:07:04 +02:00
Christophe Matthieu 600f03b294 [FIX] html2plaintext: bug 1159782
bzr revid: chm@openerp.com-20130329154130-56wjtfrj41eatxl6
2013-03-29 16:41:30 +01:00
Vo Minh Thu 1e7e2ca753 [REF] no longer use openerp.pooler.
Either use openerp.modules.registry.RegistryManager when the full
new() signature is needed, or use openerp.registry().

Replaced also some pool.get() with pool[] because KeyErrors
are better than AttributeErrors on None.

bzr revid: vmt@openerp.com-20130327111014-2i0hlvpy5y5ku7hm
2013-03-27 12:10:14 +01:00
Vo Minh Thu 013efb71cb [MERGE] Forward port of 7.0 until rev. 4767.
bzr revid: vmt@openerp.com-20130104093343-xtbw4tphmlupahuv
2013-01-04 10:33:43 +01: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 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
Frédéric van der Essen 0eac2ff48e [MERGE] from upstream
bzr revid: fva@openerp.com-20121228122804-c4t1z7x0zy2nyif0
2012-12-28 13:28:04 +01:00
Fabien Pinckaers a74d50d220 [IMP] support for lxml <2.3.1
bzr revid: fp@tinyerp.com-20121227163324-uloesoeixirmdtka
2012-12-27 17:33:24 +01:00
Thibault Delavallée 1c7b1b53d4 [IMP] sanitizer: improved logger message if crashed during sanitize.
bzr revid: tde@openerp.com-20121227092614-0ihi5sw5uuyboahk
2012-12-27 10:26:14 +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
Cedric Snauwaert f05aff8ac9 [FIX]tools/mail: fix regex when sanitizing html containing mail address
bzr revid: csn@openerp.com-20130308104850-02nfuaxdr91bo0nx
2013-03-08 11:48:50 +01:00
Frédéric van der Essen faa67b8411 [FIX] tools: email regexp was too restrictive
bzr revid: fva@openerp.com-20121220160542-hiuu3drh4fa6j8v5
2012-12-20 17:05:42 +01:00
Christophe Matthieu 111e080e48 [IMP] tools mail: don't remove xml and doctype but remove encoding attribute
bzr revid: chm@openerp.com-20121219124038-05bf07960h05x0o8
2012-12-19 13:40:38 +01:00
Christophe Matthieu 125f80888e [FIX] tools mail: return the initial variable if is false or if is not an instance of basestring. remove xml and doctype tags.
bzr revid: chm@openerp.com-20121219103714-u52hfmqr5u508xa2
2012-12-19 11:37:14 +01:00
Olivier Dony 7f5ad72429 [MERGE] Forward-port 6.1 bugfixes up to rev. 4307
rev.4307 = rev-id launchpad_translations_on_behalf_of_openerp-20121125065030-g5if5pybr61la4yj

bzr revid: odo@openerp.com-20121126160320-t2suuik6lhk6wl0x
bzr revid: odo@openerp.com-20121126161836-mv8yymzgbnmif4ve
bzr revid: odo@openerp.com-20121126162023-ejvsapwouyudw6c6
bzr revid: odo@openerp.com-20121126181527-d4yx15372bis77qj
2012-11-26 19:15:27 +01:00
Christophe Matthieu 5bbce53e35 [FIX] tools mail : html_email_clean
bzr revid: chm@openerp.com-20121120154217-4ewxir45q1wtjoax
2012-11-20 16:42:17 +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 e9a1f9f5a7 [FIX] tools mail: html_email_clean return an empty string if the are no value
bzr revid: chm@openerp.com-20121119105330-2kud8vp18gp15u9e
2012-11-19 11:53:30 +01:00
Thibault Delavallée 23743683ea [IMP] tools: html_email_clean: a bit more robust.
bzr revid: tde@openerp.com-20121114141452-n5jy3yzbmlbd3811
2012-11-14 15:14:52 +01:00
Thibault Delavallée 7508a5c724 [CLEAN] html_email_clean: cleaned a bit the code.
bzr revid: tde@openerp.com-20121114103817-t19i2sv817jsur41
2012-11-14 11:38:17 +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 b36547e3ef [CLEAN] tools: mail: removed commented code; moved some code.
bzr revid: tde@openerp.com-20121107154129-nhz7qjv1ksq521ur
2012-11-07 16:41:29 +01:00
Thibault Delavallée 688b6babed [FIX] tools: html_email_clean: remove blockquote in any node, not just firs childs of root.
bzr revid: tde@openerp.com-20121107105031-xf0u71q3chx0chnv
2012-11-07 11:50:31 +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 3ba739cbf5 [IMP] tools: mail: improved basic html_email_clean.
bzr revid: tde@openerp.com-20121107085807-td2okmbr61pm4g1e
2012-11-07 09:58:07 +01:00
Thibault Delavallée a80fab6303 [FIX] tools: mail: use beautifulsoup parser, if not present, html parser.
bzr revid: tde@openerp.com-20121106133751-ds0g2c7k8pu4d6rl
2012-11-06 14:37:51 +01:00
Thibault Delavallée f2d53fd215 [FIX] tools: mail: fixed some import, cleaned some code.
bzr revid: tde@openerp.com-20121106124109-63svzi72lx2a13yq
2012-11-06 13:41:09 +01:00
Thibault Delavallée 1d52a68dd9 [IMP] tools: mail: added html_cleaner, to clean html code to display in chatter (remove quotes, signatures, ...).
bzr revid: tde@openerp.com-20121106121737-ej57bijc7ypksu8v
2012-11-06 13:17:37 +01:00
Thibault Delavallée 5f53f5253b [FIX] tools: some import cleaning and fixing.
bzr revid: tde@openerp.com-20121106115851-5f5sfhtp2g3qrm1o
2012-11-06 12:58:51 +01:00
Thibault Delavallée da6ad1e27c [REF] tools: moved email and mail related functions from misc to mail.
bzr revid: tde@openerp.com-20121106115744-pcxgyqv3lf8zfedw
2012-11-06 12:57:44 +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