← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Graham Binns has proposed merging lp:~gmb/launchpad/fix-verbose-footer-bug-683672 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #683672 Bug description in verbose footer should be indented by 2 spaces
  https://bugs.launchpad.net/bugs/683672


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.
-- 
https://code.launchpad.net/~gmb/launchpad/fix-verbose-footer-bug-683672/+merge/42472
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~gmb/launchpad/fix-verbose-footer-bug-683672 into lp:launchpad.
=== modified file 'lib/canonical/launchpad/emailtemplates/bug-notification-verbose.txt'
--- lib/canonical/launchpad/emailtemplates/bug-notification-verbose.txt	2010-11-19 12:06:39 +0000
+++ lib/canonical/launchpad/emailtemplates/bug-notification-verbose.txt	2010-12-02 13:25:22 +0000
@@ -5,11 +5,11 @@
 %(bug_url)s
 
 Title:
-  %(bug_title)s
+%(bug_title)s
 
 %(bug_statuses)s
 
 Bug description:
-  %(bug_description)s
+%(bug_description)s
 
 %(unsubscribe_notice)s

=== modified file 'lib/canonical/launchpad/emailtemplates/bug-notification.txt'
--- lib/canonical/launchpad/emailtemplates/bug-notification.txt	2010-11-19 12:06:39 +0000
+++ lib/canonical/launchpad/emailtemplates/bug-notification.txt	2010-12-02 13:25:22 +0000
@@ -5,4 +5,4 @@
 %(bug_url)s
 
 Title:
-  %(bug_title)s
+%(bug_title)s

=== modified file 'lib/lp/bugs/doc/bugnotification-sending.txt'
--- lib/lp/bugs/doc/bugnotification-sending.txt	2010-11-26 13:54:37 +0000
+++ lib/lp/bugs/doc/bugnotification-sending.txt	2010-12-02 13:25:22 +0000
@@ -872,8 +872,13 @@
 
     >>> switch_db_to_launchpad()
     >>> bug = factory.makeBug(
-    ...     product=factory.makeProduct(title='Foo'), title='Foo is broken',
-    ...     description='desc')
+    ...     product=factory.makeProduct(title='Foo'),
+    ...     title='In the beginning, the universe was created. This '
+    ...         'has made a lot of people very angry and has been '
+    ...         'widely regarded as a bad move',
+    ...     description="This is a long description of the bug, which "
+    ...         "will be automatically wrapped by the BugNotification "
+    ...         "machinery. Ain't technology great?")
 
     >>> verbose_person = factory.makePerson(
     ...     displayname='Verbose Person', email='verbose@xxxxxxxxxxx')
@@ -984,7 +989,7 @@
     http://bugs.launchpad.dev/bugs/...
     <BLANKLINE>
     Title:
-      Foo is broken
+      In the beginning...
     <BLANKLINE>
     ----------------------------------------------------------------------
 
@@ -1005,7 +1010,7 @@
     http://bugs.launchpad.dev/bugs/...
     <BLANKLINE>
     Title:
-      Foo is broken
+      In the beginning...
     <BLANKLINE>
     ----------------------------------------------------------------------
 
@@ -1025,13 +1030,15 @@
     http://bugs.launchpad.dev/bugs/...
     <BLANKLINE>
     Title:
-      Foo is broken
+      In the beginning...
     <BLANKLINE>
     Status in Foo:
       New
     <BLANKLINE>
     Bug description:
-      desc
+       This is a long description of the bug, which
+       will be automatically wrapped by the BugNotification
+       machinery. Ain't technology great?
     <BLANKLINE>
     To unsubscribe from this bug, go to:
     http://bugs.launchpad.dev/.../+bug/.../+subscribe
@@ -1054,16 +1061,44 @@
     http://bugs.launchpad.dev/bugs/...
     <BLANKLINE>
     Title:
-      Foo is broken
+      In the beginning...
     <BLANKLINE>
     Status in Foo:
       New
     <BLANKLINE>
     Bug description:
-      desc
+       This is a long description of the bug, which
+       will be automatically wrapped by the BugNotification
+       machinery. Ain't technology great?
     <BLANKLINE>
     ----------------------------------------------------------------------
 
+It's important to note that the bug title and description are wrapped
+and indented correctly in verbose notifications.
+
+    >>> message = collated_messages['conciseteam@xxxxxxxxxxx'][0]
+    >>> payload = message.get_payload(decode=True)
+    >>> print payload.split('\n')
+    [...
+     'Title:',
+     '  In the beginning, the universe was created. This has made a lot of',
+     '  people very angry and has been widely regarded as a bad move',
+     ...
+     'Bug description:',
+     '  This is a long description of the bug, which will be automatically',
+     "  wrapped by the BugNotification machinery. Ain't technology great?",
+    ...
+
+The title is also wrapped and indented in normal notifications.
+
+    >>> message = collated_messages['verboseteam@xxxxxxxxxxx'][0]
+    >>> payload = message.get_payload(decode=True)
+    >>> print payload.split('\n')
+    [...
+     'Title:',
+     '  In the beginning, the universe was created. This has made a lot of',
+     '  people very angry and has been widely regarded as a bad move',
+     '']
 
 Notification Recipients
 -----------------------

=== modified file 'lib/lp/bugs/scripts/bugnotification.py'
--- lib/lp/bugs/scripts/bugnotification.py	2010-11-26 14:04:31 +0000
+++ lib/lp/bugs/scripts/bugnotification.py	2010-12-02 13:25:22 +0000
@@ -119,9 +119,10 @@
         else:
             unsubscribe_notice = ''
 
+        data_wrapper = MailWrapper(width=72, indent='  ')
         body_data = {
             'content': mail_wrapper.format(content),
-            'bug_title': bug.title,
+            'bug_title': data_wrapper.format(bug.title),
             'bug_url': canonical_url(bug),
             'unsubscribe_notice': unsubscribe_notice,
             'notification_rationale': mail_wrapper.format(reason)}
@@ -131,7 +132,8 @@
         # footer.
         if email_person.verbose_bugnotifications:
             email_template = 'bug-notification-verbose.txt'
-            body_data['bug_description'] = bug.description
+            body_data['bug_description'] = data_wrapper.format(
+                bug.description)
 
             status_base = "Status in %s:\n  %s"
             status_strings = []