From 239d2911df496fe11243921069b3b91bf431ba11 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Sun, 30 Aug 2009 11:54:50 -0400 Subject: Add a method for getting legal field values Add Bug.legal_values() to query the server via XML-RPC to find out legal values for a particular field. --- git-bz | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/git-bz b/git-bz index 76d28b8..6f64b80 100755 --- a/git-bz +++ b/git-bz @@ -986,6 +986,21 @@ class Bug(object): print "Attached %s" % filename + # Query the server for the legal values of the given field; returns an + # array, or None if the query failed + def legal_values(self, field): + try: + response = self.server.get_xmlrpc_proxy().Bug.legal_values({ 'field': field }) + return response['values'] + except xmlrpclib.Fault, e: + if e.faultCode == -32000: # https://bugzilla.mozilla.org/show_bug.cgi?id=513511 + return None + raise + except xmlrpclib.ProtocolError, e: # old bugzilla, no XML-RPC + if e.errcode == 404: + return None + raise + # Update specified fields of a bug; keyword arguments are interpreted # as field_name=value def update(self, **changes): -- cgit v1.2.3