Merge lp:~gmb/launchpad/fix-verbose-footer-bug-683672 into lp:launchpad

Proposed by Graham Binns
Status: Merged
Approved by: Gavin Panella
Approved revision: no longer in the source branch.
Merged at revision: 12017
Proposed branch: lp:~gmb/launchpad/fix-verbose-footer-bug-683672
Merge into: lp:launchpad
Diff against target: 156 lines (+50/-13)
4 files modified
lib/canonical/launchpad/emailtemplates/bug-notification-verbose.txt (+2/-2)
lib/canonical/launchpad/emailtemplates/bug-notification.txt (+1/-1)
lib/lp/bugs/doc/bugnotification-sending.txt (+43/-8)
lib/lp/bugs/scripts/bugnotification.py (+4/-2)
To merge this branch: bzr merge lp:~gmb/launchpad/fix-verbose-footer-bug-683672
Reviewer Review Type Date Requested Status
Gavin Panella (community) Approve
Review via email: mp+42472@code.launchpad.net

Commit message

[r=allenap][ui=none][bug=683672] The description and title of a bug will now be wrapped and indented properly in bug notification footers.

Description of the change

This bug fixes bug 683672 by adding wrapping and consistent indentation
to the bug title and description fields in bug notifications.

The fix itself is very simple and uses an instance of MailWrapper to do
the wrapping and indentation. I've updated bug-notification-sending.py
to cover the changes.

To post a comment you must log in.
Revision history for this message
Gavin Panella (allenap) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/emailtemplates/bug-notification-verbose.txt'
2--- lib/canonical/launchpad/emailtemplates/bug-notification-verbose.txt 2010-11-19 12:06:39 +0000
3+++ lib/canonical/launchpad/emailtemplates/bug-notification-verbose.txt 2010-12-02 13:25:22 +0000
4@@ -5,11 +5,11 @@
5 %(bug_url)s
6
7 Title:
8- %(bug_title)s
9+%(bug_title)s
10
11 %(bug_statuses)s
12
13 Bug description:
14- %(bug_description)s
15+%(bug_description)s
16
17 %(unsubscribe_notice)s
18
19=== modified file 'lib/canonical/launchpad/emailtemplates/bug-notification.txt'
20--- lib/canonical/launchpad/emailtemplates/bug-notification.txt 2010-11-19 12:06:39 +0000
21+++ lib/canonical/launchpad/emailtemplates/bug-notification.txt 2010-12-02 13:25:22 +0000
22@@ -5,4 +5,4 @@
23 %(bug_url)s
24
25 Title:
26- %(bug_title)s
27+%(bug_title)s
28
29=== modified file 'lib/lp/bugs/doc/bugnotification-sending.txt'
30--- lib/lp/bugs/doc/bugnotification-sending.txt 2010-11-26 13:54:37 +0000
31+++ lib/lp/bugs/doc/bugnotification-sending.txt 2010-12-02 13:25:22 +0000
32@@ -872,8 +872,13 @@
33
34 >>> switch_db_to_launchpad()
35 >>> bug = factory.makeBug(
36- ... product=factory.makeProduct(title='Foo'), title='Foo is broken',
37- ... description='desc')
38+ ... product=factory.makeProduct(title='Foo'),
39+ ... title='In the beginning, the universe was created. This '
40+ ... 'has made a lot of people very angry and has been '
41+ ... 'widely regarded as a bad move',
42+ ... description="This is a long description of the bug, which "
43+ ... "will be automatically wrapped by the BugNotification "
44+ ... "machinery. Ain't technology great?")
45
46 >>> verbose_person = factory.makePerson(
47 ... displayname='Verbose Person', email='verbose@example.com')
48@@ -984,7 +989,7 @@
49 http://bugs.launchpad.dev/bugs/...
50 <BLANKLINE>
51 Title:
52- Foo is broken
53+ In the beginning...
54 <BLANKLINE>
55 ----------------------------------------------------------------------
56
57@@ -1005,7 +1010,7 @@
58 http://bugs.launchpad.dev/bugs/...
59 <BLANKLINE>
60 Title:
61- Foo is broken
62+ In the beginning...
63 <BLANKLINE>
64 ----------------------------------------------------------------------
65
66@@ -1025,13 +1030,15 @@
67 http://bugs.launchpad.dev/bugs/...
68 <BLANKLINE>
69 Title:
70- Foo is broken
71+ In the beginning...
72 <BLANKLINE>
73 Status in Foo:
74 New
75 <BLANKLINE>
76 Bug description:
77- desc
78+ This is a long description of the bug, which
79+ will be automatically wrapped by the BugNotification
80+ machinery. Ain't technology great?
81 <BLANKLINE>
82 To unsubscribe from this bug, go to:
83 http://bugs.launchpad.dev/.../+bug/.../+subscribe
84@@ -1054,16 +1061,44 @@
85 http://bugs.launchpad.dev/bugs/...
86 <BLANKLINE>
87 Title:
88- Foo is broken
89+ In the beginning...
90 <BLANKLINE>
91 Status in Foo:
92 New
93 <BLANKLINE>
94 Bug description:
95- desc
96+ This is a long description of the bug, which
97+ will be automatically wrapped by the BugNotification
98+ machinery. Ain't technology great?
99 <BLANKLINE>
100 ----------------------------------------------------------------------
101
102+It's important to note that the bug title and description are wrapped
103+and indented correctly in verbose notifications.
104+
105+ >>> message = collated_messages['conciseteam@example.com'][0]
106+ >>> payload = message.get_payload(decode=True)
107+ >>> print payload.split('\n')
108+ [...
109+ 'Title:',
110+ ' In the beginning, the universe was created. This has made a lot of',
111+ ' people very angry and has been widely regarded as a bad move',
112+ ...
113+ 'Bug description:',
114+ ' This is a long description of the bug, which will be automatically',
115+ " wrapped by the BugNotification machinery. Ain't technology great?",
116+ ...
117+
118+The title is also wrapped and indented in normal notifications.
119+
120+ >>> message = collated_messages['verboseteam@example.com'][0]
121+ >>> payload = message.get_payload(decode=True)
122+ >>> print payload.split('\n')
123+ [...
124+ 'Title:',
125+ ' In the beginning, the universe was created. This has made a lot of',
126+ ' people very angry and has been widely regarded as a bad move',
127+ '']
128
129 Notification Recipients
130 -----------------------
131
132=== modified file 'lib/lp/bugs/scripts/bugnotification.py'
133--- lib/lp/bugs/scripts/bugnotification.py 2010-11-26 14:04:31 +0000
134+++ lib/lp/bugs/scripts/bugnotification.py 2010-12-02 13:25:22 +0000
135@@ -119,9 +119,10 @@
136 else:
137 unsubscribe_notice = ''
138
139+ data_wrapper = MailWrapper(width=72, indent=' ')
140 body_data = {
141 'content': mail_wrapper.format(content),
142- 'bug_title': bug.title,
143+ 'bug_title': data_wrapper.format(bug.title),
144 'bug_url': canonical_url(bug),
145 'unsubscribe_notice': unsubscribe_notice,
146 'notification_rationale': mail_wrapper.format(reason)}
147@@ -131,7 +132,8 @@
148 # footer.
149 if email_person.verbose_bugnotifications:
150 email_template = 'bug-notification-verbose.txt'
151- body_data['bug_description'] = bug.description
152+ body_data['bug_description'] = data_wrapper.format(
153+ bug.description)
154
155 status_base = "Status in %s:\n %s"
156 status_strings = []