[Reportbug-commits] [reportbug] 09/12: 'Control' pseudo-header can be repeated/present multiple times in the report; Closes: #687679

Sandro Tosi morph at moszumanska.debian.org
Fri Jan 1 18:37:12 UTC 2016


This is an automated email from the git hooks/post-receive script.

morph pushed a commit to branch master
in repository reportbug.

commit c0ce9b6e92fe536af564938b04f2c426a4e9a31b
Author: Sandro Tosi <morph at debian.org>
Date:   Fri Jan 1 17:51:28 2016 +0000

    'Control' pseudo-header can be repeated/present multiple times in the report; Closes: #687679
---
 debian/changelog   | 4 +++-
 reportbug/utils.py | 9 ++++++++-
 test/test_utils.py | 8 +++++++-
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 003c856..5b05bd7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,8 @@ reportbug (6.6.6) UNRELEASED; urgency=medium
 
   * reportbug/utils.py
     - Update the SUITES2DISTS mapping for the jessie release; patch by Paul Wise
+    - 'Control' pseudo-header can be repeated/present multiple times in the
+      report; Closes: #687679
   * man/querybts.1
     - document http_proxy environment variable in querybts manpage; report and
       patch by Jakub Wilk; Closes: #800092
@@ -37,7 +39,7 @@ reportbug (6.6.6) UNRELEASED; urgency=medium
   * reportbug/urlutils.py
     - remove handling of X11BROWSER and CONSOLEBROWSER, obsolete
 
- -- Sandro Tosi <morph at debian.org>  Fri, 01 Jan 2016 15:10:09 +0000
+ -- Sandro Tosi <morph at debian.org>  Fri, 01 Jan 2016 17:37:06 +0000
 
 reportbug (6.6.5) unstable; urgency=medium
 
diff --git a/reportbug/utils.py b/reportbug/utils.py
index 6336f3f..a16b545 100644
--- a/reportbug/utils.py
+++ b/reportbug/utils.py
@@ -52,6 +52,8 @@ STATUSDB = os.path.join(DPKGLIB, 'status')
 PSEUDOHEADERS = ('Package', 'Source', 'Version', 'Severity', 'File', 'Tags',
                  'Justification', 'Followup-For', 'Owner', 'User', 'Usertags',
                  'Forwarded', 'Control')
+# These pseudo-headers can be repeated in the report
+REPEATABLE_PSEUDOHEADERS = ['Control',]
 
 MODES = {'novice': 'Offer simple prompts, bypassing technical questions.',
          'standard': 'Offer more extensive prompts, including asking about '
@@ -1168,6 +1170,7 @@ def cleanup_msg(dmessage, headers, pseudos, type):
                 ph += [header]
     else:
         ph2 = {}
+        repeatable_ph = []
         # generate a list of pseudoheaders, but without duplicates
         # we take the list of pseudoheaders defined in reportbug and add
         # the ones passed by the user (if not already present). We are not using
@@ -1180,13 +1183,17 @@ def cleanup_msg(dmessage, headers, pseudos, type):
         for header, content in pseudoheaders:
             # if either in the canonical pseudo-headers list or in those passed on the command line
             if header in pseudo_list:
-                ph2[header] = content
+                if header not in REPEATABLE_PSEUDOHEADERS:
+                    ph2[header] = content
+                else:
+                    repeatable_ph += ['%s: %s' % (header, content)]
             else:
                 newheaders.append((header, content))
 
         for header in pseudo_list:
             if header in ph2:
                 ph += ['%s: %s' % (header, ph2[header])]
+        ph.extend(repeatable_ph)
 
     return message, newheaders, ph
 
diff --git a/test/test_utils.py b/test/test_utils.py
index 1232f1a..d9ccbdf 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -429,6 +429,8 @@ User: release.debian.org at packages.debian.org
 Usertags: unblock
 Severity: normal
 Morph: cool
+Control: testcontrol1
+Control: testcontrol2
 Continuation:
  header
 
@@ -448,7 +450,7 @@ Kernel: Linux 2.6.31-1-amd64 (SMP w/4 CPU cores)
 Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
 Shell: /bin/sh linked to /bin/bash"""
         header = [u'X-Debbugs-CC: reportbug at packages.qa.debian.org']
-        pseudos = ['Morph: cool']
+        pseudos = ['Morph: cool', 'Control: testcontrol1', 'Control: testcontrol2']
         rtype = 'debbugs'
         body, headers, pseudo = utils.cleanup_msg(message, header, pseudos,
                                                   rtype)
@@ -470,6 +472,10 @@ Shell: /bin/sh linked to /bin/bash"""
         self.assertIn('Usertags', p)
         self.assertIn('Morph', p)
 
+        # bts687679, verify 2 'Control' pseudo-headers are present
+        for ph in pseudos:
+            self.assertIn(ph, pseudo)
+
     @attr('network')  # marking the test as using network
     def test_generate_blank_report(self):
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reportbug/reportbug.git



More information about the Reportbug-commits mailing list