diff options
author | Will Woods <wwoods@redhat.com> | 2008-01-03 16:43:00 -0500 |
---|---|---|
committer | Will Woods <wwoods@redhat.com> | 2008-01-03 16:43:00 -0500 |
commit | f5842b6a8c2416a7b7061771f4eb3396d1474f25 (patch) | |
tree | 63f1d3f5258020febe2a6e408032b27ab7a795e2 | |
parent | 5fe216da46aa32ec2ff9bf3e11d43938f8fc6c6b (diff) | |
download | python-bugzilla-f5842b6a8c2416a7b7061771f4eb3396d1474f25.tar.gz python-bugzilla-f5842b6a8c2416a7b7061771f4eb3396d1474f25.tar.xz python-bugzilla-f5842b6a8c2416a7b7061771f4eb3396d1474f25.zip |
Simplify "modify" code block
-rwxr-xr-x | bugzilla | 24 |
1 files changed, 7 insertions, 17 deletions
@@ -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 |