From a715077769a749b78fbc0f907eef161db3b295fd Mon Sep 17 00:00:00 2001 From: Marcus Huewe Date: Wed, 23 Dec 2009 20:51:08 +0100 Subject: [PATCH] - code cleanup --- osc/commandline.py | 42 +++++++++--------------------------------- 1 file changed, 9 insertions(+), 33 deletions(-) diff --git a/osc/commandline.py b/osc/commandline.py index 6188e1a5..9c8b5e66 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -1187,42 +1187,18 @@ Please submit there instead, or use --nodevelproject to force direct submission. else: if not opts.message: opts.message = edit_message() - + state_map = {'accept' : 'accepted', 'decline' : 'declined', 'wipe' : 'deleted', 'revoke' : 'revoked'} # Change review state only if subcmd == 'review': - # decline - if cmd == 'decline': - r = change_review_state(conf.config['apiurl'], - reqid, 'declined', conf.config['user'], '', opts.message or '') - print r - # accept - elif cmd == 'accept': - r = change_review_state(conf.config['apiurl'], - reqid, 'accepted', conf.config['user'], '', opts.message or '') - print r - + if cmd in ['accept', 'decline']: + r = change_review_state(conf.config['apiurl'], + reqid, state_map[cmd], conf.config['user'], '', opts.message or '') + print r # Change state of entire request - else: - # accept - if cmd == 'accept': - r = change_request_state(conf.config['apiurl'], - reqid, 'accepted', opts.message or '') - print r - # decline - elif cmd == 'decline': - r = change_request_state(conf.config['apiurl'], - reqid, 'declined', opts.message or '') - print r - # delete/wipe - elif cmd == 'wipe': - r = change_request_state(conf.config['apiurl'], - reqid, 'deleted', opts.message or '') - print r - # revoke - elif cmd == 'revoke': - r = change_request_state(conf.config['apiurl'], - reqid, 'revoked', opts.message or '') - print r + elif cmd in ['accept', 'decline', 'wipe', 'revoke']: + r = change_request_state(conf.config['apiurl'], + reqid, state_map[cmd], opts.message or '') + print r # editmeta and its aliases are all depracated @cmdln.alias("editprj")