[python-bugzilla] [PATCH] Detection of the RH Bugzilla by the extension() call

Lukas Zachar lzachar at redhat.com
Thu Dec 13 14:33:19 UTC 2012


Part of the planed upgrade to the v4.4 of RH Bugzilla is the removal of
mirrored XMLRPC calls (rhbz#822007). Among others the
bugzilla.getProdInfo() which is currently used as indicator of RH
Bugzilla.

I believe the Bugzilla.extensions() call can be used as a indicator
instead, although it is marked as unstable.
---
  bugzilla/__init__.py |    9 +++++----
  1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/bugzilla/__init__.py b/bugzilla/__init__.py
index 1c9f3f5..2f354d9 100644
--- a/bugzilla/__init__.py
+++ b/bugzilla/__init__.py
@@ -29,11 +29,12 @@ def getBugzillaClassForURL(url):
      bzversion = ''
      c = None

-    # Check for a RH-only method
+    # Check for a Red Hat extension
      try:
-        log.debug("Checking for RH Bugzilla method bugzilla.getProdInfo()")
-        prodinfo = s.bugzilla.getProdInfo()
-        rhbz = True
+        log.debug("Checking for Red Hat Bugzilla extension")
+        extensions = s.Bugzilla.extensions()
+        if extensions.get('extensions', {}).get('RedHat', False):
+            rhbz = True
      except xmlrpclib.Fault:
          pass
      log.debug("rhbz=%s" % str(rhbz))
-- 
1.7.1


More information about the python-bugzilla mailing list