Merge lp:~openerp-dev/openobject-server/7.0-fix-mail_issues-adh into lp:openobject-server/7.0

Proposed by Anand Dharampuriya(OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-server/7.0-fix-mail_issues-adh
Merge into: lp:openobject-server/7.0
Diff against target: 35 lines (+4/-3)
2 files modified
openerp/tests/test_mail.py (+1/-1)
openerp/tools/mail.py (+3/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-server/7.0-fix-mail_issues-adh
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+222939@code.launchpad.net

Description of the change

Hello,

Here I had solved line space problem in message body and signature while you send an e-mail it does not shows line space in message and also in signature, and it shows > instead of '>' sign while you get project issue from mail after configure incomming mail server.

Regards
Anand Dharampuriya(ADH)

To post a comment you must log in.
5309. By Anand Dharampuriya(OpenERP)

[IMP] Update regualr expression for multiple line issue and fix broken test case issue

Unmerged revisions

5309. By Anand Dharampuriya(OpenERP)

[IMP] Update regualr expression for multiple line issue and fix broken test case issue

5308. By Anand Dharampuriya(OpenERP)

[FIX] Solve line space problem in message body and signature while send an e-mail, and it shows > instead of '>' sign while you get project issue from mail after configure incomming mail server

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openerp/tests/test_mail.py'
2--- openerp/tests/test_mail.py 2014-01-14 15:44:26 +0000
3+++ openerp/tests/test_mail.py 2014-06-17 05:51:09 +0000
4@@ -291,7 +291,7 @@
5 def test_plaintext2html(self):
6 cases = [
7 ("First \nSecond \nThird\n \nParagraph\n\r--\nSignature paragraph", 'div',
8- "<div><p>First <br/>Second <br/>Third</p><p>Paragraph</p><p>--<br/>Signature paragraph</p></div>"),
9+ "<div><p>First <br/>Second <br/>Third<br/> <br/>Paragraph<br/><br/>--<br/>Signature paragraph</p></div>"),
10 ("First<p>It should be escaped</p>\nSignature", False,
11 "<p>First&lt;p&gt;It should be escaped&lt;/p&gt;<br/>Signature</p>")
12 ]
13
14=== modified file 'openerp/tools/mail.py'
15--- openerp/tools/mail.py 2014-02-10 14:40:23 +0000
16+++ openerp/tools/mail.py 2014-06-17 05:51:09 +0000
17@@ -211,6 +211,7 @@
18 html = re.sub('<br\s*/?>', '\n', html)
19 html = re.sub('<.*?>', ' ', html)
20 html = html.replace(' ' * 2, ' ')
21+ html = html.replace('&gt;', '>')
22
23 # strip all lines
24 html = '\n'.join([x.strip() for x in html.splitlines()])
25@@ -242,8 +243,8 @@
26 # 2-3: form paragraphs
27 idx = 0
28 final = '<p>'
29- br_tags = re.compile(r'(([<]\s*[bB][rR]\s*\/?[>]\s*){2,})')
30- for item in re.finditer(br_tags, text):
31+ result = re.compile(r'(([<]\s*[bB][rR]\s*\/?[>]\s*){<p>\g<1></p>})')
32+ for item in re.finditer(result, text):
33 final += text[idx:item.start()] + '</p><p>'
34 idx = item.end()
35 final += text[idx:] + '</p>'