On 01/17/2014 11:19 AM, Lon Hohberger wrote:
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.
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
bin/bugzilla | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/bin/bugzilla b/bin/bugzilla
index 0ded73e..65c1f48 100755
--- a/bin/bugzilla
+++ b/bin/bugzilla
@@ -766,6 +766,16 @@ def _format_output(bz, opt, buglist):
val = ",".join([f["name"] + f["status"]
for f in getattr(b, "flags", [])])
+ elif fieldname == "flags_requestee":
+ tmpstr = []
+ for f in getattr(b, "flags", []):
+ try:
+ tmpstr.append("%s%s%s" %
+ (f['name'], f['status'],
f['requestee']))
+ except KeyError:
+ tmpstr.append("%s%s" % (f['name'],
f['status']))
+ val = ",".join(tmpstr)
+
elif fieldname == "cve":
cves = []
for key in getattr(b, "keywords", []):
Personally I find the KeyError pattern makes things less readable.
I think you can combine both these formats into the above block, something like:
elif fieldname == "flags" or fieldname == "flags_requestee":
requestee = f.get('requestee', "")
if fieldname == "flags":
requestee = ""
...
And then just unconditionally add in 'requestee'
- Cole