From 470c7dc20943d09ae8c98e6d0484d77e5b1eb778 Mon Sep 17 00:00:00 2001 From: Will Woods Date: Fri, 15 Aug 2008 14:18:51 -0400 Subject: Add RHBugzilla32 class and shuffle methods around - API docs say that most of the good stuff is RH-specific. Still. --- bugzilla/bugzilla3.py | 56 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 20 deletions(-) (limited to 'bugzilla') diff --git a/bugzilla/bugzilla3.py b/bugzilla/bugzilla3.py index bcefcde..3fe3052 100644 --- a/bugzilla/bugzilla3.py +++ b/bugzilla/bugzilla3.py @@ -110,14 +110,46 @@ class Bugzilla3(bugzilla.base.BugzillaBase): r = self._proxy.Bug.create(data) return r['id'] -# Bugzilla 3.2 adds a whole bunch of new goodies on top of Bugzilla3. +# Bugzilla 3.2 adds some new goodies on top of Bugzilla3. class Bugzilla32(Bugzilla3): '''Concrete implementation of the Bugzilla protocol. This one uses the - methods provided by standard Bugzilla 3.2.x releases.''' + methods provided by standard Bugzilla 3.2.x releases. + + For further information on the methods defined here, see the API docs: + http://www.bugzilla.org/docs/3.2/en/html/api/ + ''' version = '0.1' user_agent = bugzilla.base.user_agent + ' Bugzilla32/%s' % version + def _addcomment(self,id,comment,private=False, + timestamp='',worktime='',bz_gid=''): + '''Add a comment to the bug with the given ID. Other optional + arguments are as follows: + private: if True, mark this comment as private. + timestamp: comment timestamp, in the form "YYYY-MM-DD HH:MM:SS" + Ignored by BZ32. + worktime: amount of time spent on this comment, in hours + bz_gid: if present, and the entire bug is *not* already private + to this group ID, this comment will be marked private. + ''' + return self._proxy.Bug.add_comment({'id':id, + 'comment':comment, + 'private':private, + 'work_time':worktime}) + +class RHBugzilla32(Bugzilla32): + '''Concrete implementation of the Bugzilla protocol. This one uses the + methods provided by Red Hat's Bugzilla 3.1.4+ instance, which are supposed + to make their way into Bugzilla 3.4. + + This class was written using bugzilla.redhat.com's API docs: + https://bugzilla.redhat.com/docs/en/html/api/ + ''' + + version = '0.1' + user_agent = bugzilla.base.user_agent + ' RHBugzilla32/%s' % version + 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']. @@ -137,6 +169,8 @@ class Bugzilla32(Bugzilla3): #used (see the list in querydefaults['default_column_list']). return self._proxy.Bug.search(query) + #---- Methods for updating bugs. + def _update_bug(self,id,updates): '''Update a single bug, specified by integer ID or (string) bug alias. Really just a convenience method for _update_bugs(ids=[id],updates)''' @@ -152,24 +186,6 @@ class Bugzilla32(Bugzilla3): # TODO I think we need to catch XMLRPC exceptions to get return self._proxy.Bug.update({'ids':ids,'updates':updates}) - def _addcomment(self,id,comment,private=False, - timestamp='',worktime='',bz_gid=''): - '''Add a comment to the bug with the given ID. Other optional - arguments are as follows: - private: if True, mark this comment as private. - timestamp: comment timestamp, in the form "YYYY-MM-DD HH:MM:SS" - Ignored by BZ32. - worktime: amount of time spent on this comment, in hours - bz_gid: if present, and the entire bug is *not* already private - to this group ID, this comment will be marked private. - ''' - return self._proxy.Bug.add_comment({'id':id, - 'comment':comment, - 'private':private, - 'worktime':worktime}) - - #---- Methods for updating bugs. - # Eventually - when RHBugzilla is well and truly obsolete - we'll delete # all of these methods and refactor the Base Bugzilla object so all the bug # modification calls go through _update_bug. -- cgit