summaryrefslogtreecommitdiffstats
path: root/bugzilla
diff options
context:
space:
mode:
Diffstat (limited to 'bugzilla')
-rw-r--r--bugzilla/base.py4
-rw-r--r--bugzilla/bugzilla3.py29
2 files changed, 29 insertions, 4 deletions
diff --git a/bugzilla/base.py b/bugzilla/base.py
index 6fb8f89..18da60a 100644
--- a/bugzilla/base.py
+++ b/bugzilla/base.py
@@ -713,6 +713,10 @@ class Bug(object):
desc = self.short_short_desc
else:
desc = self.short_desc
+ # Some BZ3 implementations give us an ID instead of a name.
+ if 'assigned_to' not in self.__dict__:
+ if 'assigned_to_id' in self.__dict__:
+ self.assigned_to = self.bugzilla._getuserforid(self.assigned_to_id)
return "#%-6s %-10s - %s - %s" % (self.bug_id,self.bug_status,
self.assigned_to,desc)
def __repr__(self):
diff --git a/bugzilla/bugzilla3.py b/bugzilla/bugzilla3.py
index 3dda1a5..5e38c97 100644
--- a/bugzilla/bugzilla3.py
+++ b/bugzilla/bugzilla3.py
@@ -23,16 +23,33 @@ class Bugzilla3(bugzilla.base.BugzillaBase):
#---- Methods and properties with basic bugzilla info
+ def _getuserforid(self,userid):
+ '''Get the username for the given userid'''
+ # STUB FIXME
+ return str(userid)
+
# Connect the backend methods to the XMLRPC methods
def _getbugfields(self):
- #return self._proxy.bugzilla.getBugFields(self.user,self.password)
- raise NotImplementedError
+ '''Get a list of valid fields for bugs.'''
+ #I don't think BZ3 provides a getbugfields() method, so right
+ #we fake it by looking at bug #1. Yuck.
+ keylist = self._getbug(1).keys()
+ if 'assigned_to' not in keylist:
+ keylist.append('assigned_to')
+ return keylist
def _getqueryinfo(self):
#return self._proxy.bugzilla.getQueryInfo(self.user,self.password)
raise NotImplementedError
def _getproducts(self):
+ '''This throws away a bunch of data that RH's getProdInfo
+ didn't return. Ah, abstraction.'''
product_ids = self._proxy.Product.get_accessible_products()
- return self._proxy.Product.get_products(product_ids)
+ r = self._proxy.Product.get_products(product_ids)
+ pdict = {}
+ for p in r['products']:
+ pdict[p['name']] = p['description']
+ return pdict
+
def _getcomponents(self,product):
#return self._proxy.bugzilla.getProdCompInfo(product,self.user,self.password)
raise NotImplementedError
@@ -42,13 +59,17 @@ class Bugzilla3(bugzilla.base.BugzillaBase):
#---- Methods for reading bugs and bug info
+ def _getbugs(self,idlist):
+ r = self._proxy.Bug.get_bugs({'ids':idlist})
+ return [i['internals'] for i in r['bugs']]
def _getbug(self,id):
'''Return a dict of full bug info for the given bug id'''
- return self._proxy.Bug.get(id)
+ return self._getbugs([id])[0]
def _getbugsimple(self,id):
'''Return a short dict of simple bug info for the given bug id'''
# Bugzilla3 doesn't have this
return self._getbug(id)
+
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'].