summaryrefslogtreecommitdiffstats
path: root/bugzilla
diff options
context:
space:
mode:
authorWill Woods <wwoods@redhat.com>2008-01-03 16:43:00 -0500
committerWill Woods <wwoods@redhat.com>2008-01-03 16:43:00 -0500
commitf5842b6a8c2416a7b7061771f4eb3396d1474f25 (patch)
tree63f1d3f5258020febe2a6e408032b27ab7a795e2 /bugzilla
parent5fe216da46aa32ec2ff9bf3e11d43938f8fc6c6b (diff)
downloadpython-bugzilla-f5842b6a8c2416a7b7061771f4eb3396d1474f25.zip
python-bugzilla-f5842b6a8c2416a7b7061771f4eb3396d1474f25.tar.gz
python-bugzilla-f5842b6a8c2416a7b7061771f4eb3396d1474f25.tar.xz
Simplify "modify" code block
Diffstat (limited to 'bugzilla')
-rwxr-xr-xbugzilla24
1 files changed, 7 insertions, 17 deletions
diff --git a/bugzilla b/bugzilla
index cdbaa84..0d05c78 100755
--- a/bugzilla
+++ b/bugzilla
@@ -251,29 +251,19 @@ if __name__ == '__main__':
else:
bugid_list.append(a)
# Surely there's a simpler way to do that..
-
# bail out if no bugs were given
if not bugid_list:
parser.error('No bug IDs given (maybe you forgot an argument somewhere?)')
# Iterate over a list of Bug objects
# FIXME: this should totally use some multicall magic
- buglist = bz.getbugs(bugid_list)
- for bug in buglist:
+ for bug in bz.getbugssimple(bugid_list):
log.debug("modifying bug %s" % bug.bug_id)
- for cmd in ['comment','close']:
- val = getattr(opt,cmd)
- if not val:
- continue
- if cmd == 'comment':
- log.debug(" add comment: %s" % val)
- bug.addcomment(val)
- elif cmd == 'close':
- log.debug(" close %s" % val)
- bug.close(val)
- else:
- # FIXME error out properly
- log.error("Unknown command %s slipped through" % cmd)
-
+ if opt.comment:
+ log.debug(" add comment: %s" % opt.comment)
+ bug.addcomment(opt.comment)
+ if opt.close:
+ log.debug(" close %s" % opt.close)
+ bug.close(opt.close)
else:
print "Sorry - '%s' not implemented yet." % action