summaryrefslogtreecommitdiffstats
path: root/bugzilla
diff options
context:
space:
mode:
authorWill Woods <wwoods@redhat.com>2008-08-05 15:58:19 -0400
committerWill Woods <wwoods@redhat.com>2008-08-05 15:58:19 -0400
commit9434dd7a60859bc8b1f72fe28d8733bd0556c385 (patch)
tree836580feb0d80f6ed2c3497bc84fd174a3f43f94 /bugzilla
parent2de4aecfcdf639aed2d895d84a629651c45c1351 (diff)
downloadpython-bugzilla-9434dd7a60859bc8b1f72fe28d8733bd0556c385.zip
python-bugzilla-9434dd7a60859bc8b1f72fe28d8733bd0556c385.tar.gz
python-bugzilla-9434dd7a60859bc8b1f72fe28d8733bd0556c385.tar.xz
Use Bugzilla32 where applicable
Diffstat (limited to 'bugzilla')
-rw-r--r--bugzilla/__init__.py29
1 files changed, 21 insertions, 8 deletions
diff --git a/bugzilla/__init__.py b/bugzilla/__init__.py
index 8561921..2e5ee75 100644
--- a/bugzilla/__init__.py
+++ b/bugzilla/__init__.py
@@ -9,7 +9,7 @@
# option) any later version. See http://www.gnu.org/copyleft/gpl.html for
# the full text of the license.
-from bugzilla3 import Bugzilla3
+from bugzilla3 import Bugzilla3, Bugzilla32
from rhbugzilla import RHBugzilla
import xmlrpclib
import logging
@@ -17,23 +17,36 @@ log = logging.getLogger("bugzilla")
def getBugzillaClassForURL(url):
s = xmlrpclib.ServerProxy(url)
- # RH Bugzilla method
- prodinfo = {}
+ rhbz = False
+ bzversion = ''
+ c = None
+
+ # Check for a RH-only method
try:
prodinfo = s.bugzilla.getProdInfo()
- return RHBugzilla
+ rhbz = True
except xmlrpclib.Fault:
pass
+ # Try to get the bugzilla version string
try:
r = s.Bugzilla.version()
- version = r['version']
- if version.startswith('3.'):
- return Bugzilla3
+ bzversion = r['version']
except xmlrpclib.Fault:
pass
- return None
+ # current preference order: RHBugzilla, Bugzilla3
+ # 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:
+ c = RHBugzilla
+ elif bzversion.startswith('3.'):
+ if bzversion.startswith('3.0'):
+ c = Bugzilla3
+ else: # 3.1 or higher
+ c = Bugzilla32
+
+ return c
class Bugzilla(object):
'''Magical Bugzilla class that figures out which Bugzilla implementation