summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWill Woods <wwoods@redhat.com>2008-09-04 12:28:16 -0400
committerWill Woods <wwoods@redhat.com>2008-09-04 12:28:16 -0400
commitce753c44a0445b796cd19851cba8dff2e5d455d0 (patch)
tree406ed4873ac272f05918a4d6d7e246a3bcb5616b
parent8765e33c2267b1408bd4d11d1bf596ad1d53eb21 (diff)
downloadpython-bugzilla-ce753c44a0445b796cd19851cba8dff2e5d455d0.zip
python-bugzilla-ce753c44a0445b796cd19851cba8dff2e5d455d0.tar.gz
python-bugzilla-ce753c44a0445b796cd19851cba8dff2e5d455d0.tar.xz
Add comments, raise exception if Bugzilla class autodetection fails
-rw-r--r--TODO1
-rw-r--r--bugzilla/__init__.py11
-rw-r--r--bugzilla/rhbugzilla.py1
3 files changed, 8 insertions, 5 deletions
diff --git a/TODO b/TODO
index 9f73ffd..5e342ac 100644
--- a/TODO
+++ b/TODO
@@ -1,4 +1,3 @@
-- Finish up RHBZ3
- better documentation for abstract methods in BugzillaBase
- more consistent calls for abstract methods
- make the abstract methods return stuff closer to Bugzilla3's return values
diff --git a/bugzilla/__init__.py b/bugzilla/__init__.py
index dfda0c4..564f00b 100644
--- a/bugzilla/__init__.py
+++ b/bugzilla/__init__.py
@@ -41,9 +41,8 @@ def getBugzillaClassForURL(url):
pass
log.debug("bzversion='%s'" % str(bzversion))
- # current preference order: RHBugzilla, Bugzilla3
+ # XXX note preference order: RHBugzilla* wins if available
# RH BZ 3.2 will have rhbz == True and bzversion == 3.1.x or 3.2.x.
- # To prefer Bugzilla32 over RHBugzilla do: if rhbz and (bzversion == '')
if rhbz:
if bzversion.startswith('3.'):
c = RHBugzilla3
@@ -59,7 +58,8 @@ def getBugzillaClassForURL(url):
class Bugzilla(object):
'''Magical Bugzilla class that figures out which Bugzilla implementation
- to use and uses that.'''
+ to use and uses that. Requires 'url' parameter so we can check available
+ XMLRPC methods to determine the Bugzilla version.'''
def __init__(self,**kwargs):
log.info("Bugzilla v%s initializing" % base.version)
if 'url' in kwargs:
@@ -68,4 +68,7 @@ class Bugzilla(object):
self.__class__ = c
c.__init__(self,**kwargs)
log.info("Chose subclass %s v%s" % (c.__name__,c.version))
- # FIXME no url? raise an error or something here, jeez
+ else:
+ raise ValueError, "Couldn't determine Bugzilla version for %s" % kwargs['url']
+ else:
+ raise TypeError, "You must pass a valid bugzilla xmlrpc.cgi URL"
diff --git a/bugzilla/rhbugzilla.py b/bugzilla/rhbugzilla.py
index cdad54d..47a3e22 100644
--- a/bugzilla/rhbugzilla.py
+++ b/bugzilla/rhbugzilla.py
@@ -353,6 +353,7 @@ class RHBugzilla3(Bugzilla32, RHBugzilla):
self.user_agent = self.__class__.user_agent
self.multicall = kwargs.get('multicall',True)
+ # XXX it'd be nice if this wasn't just a copy of RHBugzilla's _getbugs
def _getbugs(self,idlist):
r = []
if self.multicall: