Skip to content
Snippets Groups Projects
Commit 387f416a authored by Mr. Dmitry Makovey's avatar Mr. Dmitry Makovey
Browse files

add formatting/filtering to output for held messages

parent 6d9bd64f
No related branches found
No related tags found
No related merge requests found
......@@ -27,9 +27,15 @@ def held_list(args):
client, ml = get_ml(args)
held_data = {}
for held in ml.held:
held_data[held.request_id] = held.rest_data
if not args.detailed:
del held_data[held.request_id]['msg']
if args.fields:
data_hash = {}
for f in args.fields:
data_hash[f] = held.rest_data[f]
held_data[held.request_id] = data_hash
else:
held_data[held.request_id] = held.rest_data
if not args.detailed:
del held_data[held.request_id]['msg']
print json.dumps(held_data, indent=2)
......@@ -108,6 +114,8 @@ if __name__ == '__main__':
held_list_parser.add_argument('--detailed', action='store_true',
default=False
)
held_list_parser.add_argument('--field', dest='fields',
action='append', default=None)
held_approve_parser = held_subparsers.add_parser('approve')
held_approve_parser.set_defaults(func=held_approve)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment