summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWill Woods <wwoods@redhat.com>2008-08-26 17:34:21 -0400
committerWill Woods <wwoods@redhat.com>2008-08-26 17:34:21 -0400
commit3730239a0cad74fa7ab0a8a69bb12daa79a1174e (patch)
treec04a04333a104d3f301b539f15502c9a630b21ac
parente22c1f4fbfb268cf4970ae874e8d5988cb5f834f (diff)
downloadpython-bugzilla-3730239a0cad74fa7ab0a8a69bb12daa79a1174e.tar.gz
python-bugzilla-3730239a0cad74fa7ab0a8a69bb12daa79a1174e.tar.xz
python-bugzilla-3730239a0cad74fa7ab0a8a69bb12daa79a1174e.zip
Attempt to support multicall _getbugs in RHBugzilla3
-rw-r--r--bugzilla/rhbugzilla.py31
1 files changed, 28 insertions, 3 deletions
diff --git a/bugzilla/rhbugzilla.py b/bugzilla/rhbugzilla.py
index d7d6295..34b8318 100644
--- a/bugzilla/rhbugzilla.py
+++ b/bugzilla/rhbugzilla.py
@@ -332,16 +332,41 @@ class RHBugzilla3(Bugzilla32, RHBugzilla):
of the Bugzilla 3.2 methods. The additional methods (Bug.search, Bug.update)
should make their way into a later upstream Bugzilla release (probably 4.0).
- Note that RHBZ3 *also* supports most of the old RHBZ methods, under the
- 'bugzilla' namespace.
-
+ Note that RHBZ3 *also* supports most of the old RHBZ methods, under the
+ 'bugzilla' namespace, so we use those when BZ3 methods aren't available.
+
This class was written using bugzilla.redhat.com's API docs:
https://bugzilla.redhat.com/docs/en/html/api/
+
+ By default, _getbugs will multicall Bug.get(id) multiple times, rather than
+ doing a single Bug.get(idlist) call. You can disable this behavior by
+ setting the 'multicall' property to False. This is faster, but less
+ compatible with RHBugzilla.
'''
version = '0.1'
user_agent = bugzilla.base.user_agent + ' RHBugzilla3/%s' % version
+ def __init__(self,**kwargs):
+ Bugzilla32.__init__(self,**kwargs)
+ self.user_agent = self.__class__.user_agent
+ self.multicall = kwargs.get('multicall',True)
+
+ def _getbugs(self,idlist):
+ r = []
+ if self.multicall:
+ mc = self._multicall()
+ for id in idlist:
+ mc._proxy.bugzilla.getBug(id)
+ raw_results = mc.run()
+ del mc
+ # check results for xmlrpc errors, and replace them with None
+ r = bugzilla.base.replace_getbug_errors_with_None(raw_results)
+ else:
+ raw_results = self._proxy.Bug.get({'ids':idlist})
+ r = [i['internals'] for i in raw_results['bugs']]
+ return r
+
def _query(self,query):
'''Query bugzilla and return a list of matching bugs.
query must be a dict with fields like those in in querydata['fields'].