[bts-link] 02/02: Make sure btsinfo still works for newer bugzillas

Olivier Berger obergix at moszumanska.debian.org
Tue Dec 8 10:03:56 UTC 2015


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

obergix pushed a commit to branch obergix-master
in repository bts-link.

commit 873a7c5704e43f86bfe218e6bd54a1c83f7ff359
Author: Olivier Berger <olivier.berger at telecom-sudparis.eu>
Date:   Tue Dec 8 11:00:16 2015 +0100

    Make sure btsinfo still works for newer bugzillas
---
 remote/bugzilla.py | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/remote/bugzilla.py b/remote/bugzilla.py
index 08f7877..d96e41a 100644
--- a/remote/bugzilla.py
+++ b/remote/bugzilla.py
@@ -121,12 +121,15 @@ class OldRemoteBugzilla(RemoteBts):
     def isWontfix(self, status, resolution):
         return resolution == 'WONTFIX'
 
+    def _getApiUri(self, bugId):
+        return "%s/xml.cgi?id=%s" % (self._cnf['uri'], bugId)
 
     def _getReportData(self, uri):
         id = self.extractBugid(uri)
         if not id: return None
 
-        uri  = "%s/xml.cgi?id=%s" % (self._cnf['uri'], id)
+        uri = self._getApiUri(id)
+        
         data = OldBugzillaData(uri)
         while data.resolution == 'DUPLICATE':
             uri  = "%s/xml.cgi?id=%s" % (self._cnf['uri'], data.duplicate)
@@ -135,9 +138,17 @@ class OldRemoteBugzilla(RemoteBts):
         return data
 
 class RemoteBugzilla(OldRemoteBugzilla):
+    
+    api_fields = ["bug_id", "bug_status", "resolution", "dup_id", "long_desc"]
+    
     def __init__(self, cnf):
         OldRemoteBugzilla.__init__(self, cnf)
 
+    def _getApiUri(self, bugId):
+        qs  = "ctype=xml&field=" + "&field=".join(self.api_fields)
+        qs += '&id=%s' % bugId
+        return '%s/show_bug.cgi?%s' % (self._cnf['uri'], qs)
+
     def enqueue(self, btsbug):
         id = self.extractBugid(btsbug.forward)
         if id is None:
@@ -155,8 +166,7 @@ class RemoteBugzilla(OldRemoteBugzilla):
                 subq = self._queue
                 self._queue = []
 
-            fields = ["bug_id", "bug_status", "resolution", "dup_id", "long_desc"]
-            qs  = "ctype=xml&field=" + "&field=".join(fields)
+            qs  = "ctype=xml&field=" + "&field=".join(self.api_fields)
             qs += '&id=' + '&id='.join([x[1] for x in subq])
             massuri = "%s/show_bug.cgi?%s" % (self._cnf['uri'], qs)
 

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



More information about the bts-link-commits mailing list