From f5842b6a8c2416a7b7061771f4eb3396d1474f25 Mon Sep 17 00:00:00 2001 From: Will Woods Date: Thu, 3 Jan 2008 16:43:00 -0500 Subject: Simplify "modify" code block --- bugzilla | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) (limited to 'bugzilla') 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 -- cgit