From 731583b6079d863789ee79bb60481b88c4165a74 Mon Sep 17 00:00:00 2001 From: "steven.bethard" Date: Sat, 12 Sep 2009 15:56:57 +0000 Subject: Fix bug with mutually exclusive groups in parent= parsers. --- argparse.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'argparse.py') diff --git a/argparse.py b/argparse.py index 8950cc7..cb77a4a 100644 --- a/argparse.py +++ b/argparse.py @@ -1281,6 +1281,17 @@ class _ActionsContainer(object): for action in group._group_actions: group_map[action] = title_group_map[group.title] + # add container's mutually exclusive groups + # NOTE: if add_mutually_exclusive_group ever gains title= and + # description= then this code will need to be expanded as above + for group in container._mutually_exclusive_groups: + mutex_group = self.add_mutually_exclusive_group( + required=group.required) + + # map the actions to their new mutex group + for action in group._group_actions: + group_map[action] = mutex_group + # add all actions to this container or their group for action in container._actions: group_map.get(action, self)._add_action(action) -- cgit v1.2.1