[Reportbug-commits] [SCM] Reportbug - reports bugs in the Debian distribution branch, master, updated. 4.9-207-ge4c5fe7

Sandro Tosi morph at debian.org
Wed Aug 10 22:02:39 UTC 2011


The following commit has been merged in the master branch:
commit 3a3ebac1616106accdeb54fb9915b56474305aee
Author: Sandro Tosi <morph at debian.org>
Date:   Tue Aug 9 14:09:11 2011 +0200

    converted get_report() to SOAP interface

diff --git a/reportbug/debbugs.py b/reportbug/debbugs.py
index 5cc0945..11db97d 100644
--- a/reportbug/debbugs.py
+++ b/reportbug/debbugs.py
@@ -25,6 +25,7 @@ import utils
 import sys
 import mailbox
 import email
+import email.parser
 import email.Errors
 import cStringIO
 import sgmllib
@@ -35,6 +36,8 @@ import time
 import urllib
 import textwrap
 import pprint
+# SOAP interface to Debian BTS
+import debianbts
 
 import checkversions
 from exceptions import (
@@ -1231,6 +1234,28 @@ def get_reports(package, timeout, system='debian', mirrors=None, version=None,
 def get_report(number, timeout, system='debian', mirrors=None,
                http_proxy='', archived=False, followups=False):
     number = int(number)
+
+    if system == 'debian':
+        status = debianbts.get_status(number)
+        log = debianbts.get_bug_log(number)
+
+        # add Date/Subject/From headers to the msg bodies
+        bodies = []
+        for l in log:
+            f = email.parser.FeedParser()
+            f.feed(l['header'])
+            h = f.close()
+            hdrs = []
+            for i in ['Date', 'Subject', 'From']:
+                hdrs.append(i + ': ' + h.get(i))
+            bodies.append('\n'.join(sorted(hdrs)) + '\n\n' + l['body'])
+
+        # subject, in a more nice format
+        subject = '#%d: %s' %(number, status[0].subject)
+
+        # returns the subject and a list of mail bodies
+        return (subject, bodies)
+
     if SYSTEMS[system].get('cgiroot'):
         result = get_cgi_report(number, timeout, system, http_proxy,
                                 archived, followups)

-- 
Reportbug - reports bugs in the Debian distribution



More information about the Reportbug-commits mailing list