[PATCH] add a CC at the last menu

Carl Chenet carl.chenet at ohmytux.com
Sat Jun 20 10:23:01 UTC 2009


---
 bin/reportbug |   24 +++++++++++++++++++-----
 1 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/bin/reportbug b/bin/reportbug
index 5c31646..9d69b2c 100755
--- a/bin/reportbug
+++ b/bin/reportbug
@@ -142,6 +142,8 @@ def include_file_in_report(message, message_filename,
 
     return (message, message_filename, attachment_filenames)
 
+# Useful to retrieve CCs given in handle_editing
+CCS = []
 def handle_editing(filename, dmessage, options, sendto, attachments, package,
                    editor=None, charset='utf-8'):
     if not editor:
@@ -187,10 +189,10 @@ def handle_editing(filename, dmessage, options, sendto, attachments, package,
         if not subject:
             ui.long_message('No subject found in message.  Please edit again.\n')
 
-        menuopts = "Ynaceilmpqd"
+        menuopts = "Ynaceilmpqds"
 
         if not changed or not subject:
-            menuopts = "ynacEilmpqd"
+            menuopts = "ynacEilmpqds"
 
         # cfr Debian BTS #293361
         if package == 'wnpp':
@@ -218,6 +220,7 @@ def handle_editing(filename, dmessage, options, sendto, attachments, package,
                                'e': 'Re-edit the bug report.',
                                'l': 'Pipe the message through the pager.',
                                'p': 'Print message to stdout.',
+                               's': 'Add a carbon copy.',
                                'm': "Choose a mailer to edit the report."})
 
         if x in ('a', 'i'):
@@ -281,6 +284,16 @@ def handle_editing(filename, dmessage, options, sendto, attachments, package,
                 os.popen(pager, 'w').write(message.encode(charset, 'replace'))
             else:
                 sys.stdout.write(message.encode(charset, 'replace'))
+        elif x == 's':
+            skip_editing = True
+            ccemail = ui.get_string(
+                ('Please add the email address. Just press ENTER if you '
+                 'don\'t want anymore.'), empty_ok=True, force_prompt=True)
+            if ccemail:
+                CCS.append(ccemail)
+                ewrite('The CC address was added.\n')
+            else:
+                ewrite('No CC address was added.\n')
         elif x == 'y':
             if message == dmessage:
                 x = ui.select_options(
@@ -1771,9 +1784,6 @@ For more details, please see: http://www.debian.org/devel/wnpp/''')
             listcc += ['Debian Security Team <team at security.debian.org>']
             listcc += ['Debian Testing Security Team <secure-testing-team at lists.alioth.debian.org>']
 
-        if listcc:
-            headers.append('X-Debbugs-CC: '+', '.join(listcc))
-
         # Prepare bug report
         if self.options.kudos:
             message = u'\n\n'
@@ -1854,6 +1864,10 @@ For more details, please see: http://www.debian.org/devel/wnpp/''')
                             ewrite('%s not found!', attachfile)
                     else:
                         break
+        if CCS:
+            listcc += CCS
+        if listcc:
+            headers.append('X-Debbugs-CC: '+', '.join(listcc))
 
         body, headers, pseudoheaders = utils.cleanup_msg(message,headers,rtype)
 
-- 
1.5.4.3


--=-XZ8hMjxMd57uaSu/ioRY--






More information about the Reportbug-maint mailing list