diff options
author | Owen W. Taylor <otaylor@fishsoup.net> | 2009-08-30 11:54:50 -0400 |
---|---|---|
committer | Owen W. Taylor <otaylor@fishsoup.net> | 2009-08-30 11:58:23 -0400 |
commit | 239d2911df496fe11243921069b3b91bf431ba11 (patch) | |
tree | e309c540c13f4fb916b69af48ec4cf9790e4923a | |
parent | 970fd582a8af194e7e483883b129f8490821b4e6 (diff) |
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.
-rwxr-xr-x | git-bz | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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): |