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

Sandro Tosi morph at moszumanska.debian.org
Wed Dec 30 01:38:00 UTC 2015


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

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

commit 5438c5abf32f0823d127a61f8364706052faebbd
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