[python-bugzilla] [PATCH] Add flags_requestee as an outputformat specifier

Lon Hohberger lhh at redhat.com
Fri Jan 17 16:55:33 UTC 2014


Some bugzilla instances (like Red Hat's) allow for
flags to have a requestee - the most common is the
'needinfo' flag.  It's helpful to know who the bug
needs information from, so this allows providing
that information without breaking the existing output
format.

Resubmit based on feedback from Cole Robinson.

Signed-off-by: Lon Hohberger <lhh at redhat.com>
---
 bin/bugzilla | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/bin/bugzilla b/bin/bugzilla
index 0ded73e..73fe5dd 100755
--- a/bin/bugzilla
+++ b/bin/bugzilla
@@ -762,9 +762,14 @@ def _format_output(bz, opt, buglist):
         if fieldname == "flag" and rest:
             val = b.get_flag_status(rest)
 
-        elif fieldname == "flags":
-            val = ",".join([f["name"] + f["status"]
-                            for f in getattr(b, "flags", [])])
+        elif fieldname == "flags" or fieldname == "flags_requestee":
+            tmpstr = []
+            for f in getattr(b, "flags", []):
+                requestee = f.get('requestee', "");
+                if fieldname == "flags":
+                    requestee = ""
+                tmpstr.append("%s%s%s" % (f['name'], f['status'], requestee))
+            val = ",".join(tmpstr)
 
         elif fieldname == "cve":
             cves = []
-- 
1.8.4.2



More information about the python-bugzilla mailing list