Fixed groups inside subparsers

This commit is contained in:
Christoph Stahl 2017-05-30 19:22:25 +02:00
parent b589dd70f3
commit 63e8059e94

View file

@ -13,7 +13,6 @@ app = Flask(__name__)
app.mutex_groups=[] app.mutex_groups=[]
def parse_argument(name, json, action, namespace): def parse_argument(name, json, action, namespace):
print(name)
try: try:
argument = json[name] argument = json[name]
if type(argument) == list: if type(argument) == list:
@ -31,12 +30,11 @@ def parse_argument(name, json, action, namespace):
try: try:
for name, choice in action.choices.items(): for name, choice in action.choices.items():
print(choice)
actions = choice.actions actions = choice.actions
for group in choice.groups: for group in choice.groups:
action.extend(group.actions) actions.extend(group.actions)
for action in actions: for act in actions:
parse_argument(action.name, json, action, namespace) parse_argument(act.name, json, act, namespace)
except AttributeError: except AttributeError:
pass pass
@ -48,7 +46,6 @@ def fill_namespace():
json = dict(request.form) json = dict(request.form)
namespace = argparse.Namespace() namespace = argparse.Namespace()
all_actions = app.actions all_actions = app.actions
print(all_actions)
for group in app.mutex_groups: for group in app.mutex_groups:
all_actions.extend(group.actions) all_actions.extend(group.actions)