Author nickpapior
Recipients nickpapior
Date 2016-08-25.15:02:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1472137330.56.0.683571624156.issue27859@psf.upfronthosting.co.za>
In-reply-to
Content
Using argparse does not retain the Namespace variable across sub-parsers.

This prohibits customization of Actions due to "upper" level arguments not being stored in the namespace passed to the sub-parsers.

Hence, one may not create different sub-parsers which depend on an upper level flag.

The reason is the subparser command:
    subnamespace, arg_strings = parser.parse_known_args(arg_strings, None)

Which by default passes `None` as the namespace argument.

A simple patch would be to copy the original namespace, which may then be altered. And subsequently restored, based on changes to that namespace.
History
Date User Action Args
2016-08-25 15:02:10nickpapiorsetrecipients: + nickpapior
2016-08-25 15:02:10nickpapiorsetmessageid: <1472137330.56.0.683571624156.issue27859@psf.upfronthosting.co.za>
2016-08-25 15:02:10nickpapiorlinkissue27859 messages
2016-08-25 15:02:10nickpapiorcreate