cliff.command.Command.__init__() receives different type of app_args

Bug #1421585 reported by takehiro-kaneko
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cliff
Fix Released
Undecided
Terry Howe

Bug Description

The function __init__() of subcommand classes that override cliff.command.Command receive different type of app_args.
app_args will be an argparse.Namespace object when the classes are instantiated from cliff.app.App.run_subcommand().
On the other hand, app_args will be a list object when the classes are instantiated from cliff.help.HelpCommand.

For example, ...

class Subcommand(Command):

    def __init__(self, app, app_args):
        super(Subcommand, self).__init__(app, app_args)

        # When the help command is called,
        # the type of 'app_args' will be a list.
        if isinstance(app_args, argparse.Namespace):
            self.hogehoge = app_args.hogehoge
            ....

I'd like to unify this inconsistent behavior.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cliff (master)

Fix proposed to branch: master
Review: https://review.openstack.org/155784

Changed in python-cliff:
assignee: nobody → Terry Howe (thowe-g)
status: New → In Progress
Revision history for this message
Terry Howe (thowe-g) wrote :

I threw that fix out there, but Doug would have a better idea of the repercussions of the change.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cliff (master)

Reviewed: https://review.openstack.org/155784
Committed: https://git.openstack.org/cgit/openstack/cliff/commit/?id=299fbb7a460cd0a957b15401ab155d53e922c42a
Submitter: Jenkins
Branch: master

commit 299fbb7a460cd0a957b15401ab155d53e922c42a
Author: Terry Howe <email address hidden>
Date: Fri Feb 13 08:26:54 2015 -0700

    Change the argument passed to __init__ for help

    Pass original argparse.NameSpace in the help command after adding
    the search_args to it.

    Change-Id: Ib541997deeffcb7301e8b97db44732656c935431
    Closes-Bug: 1421585

Changed in python-cliff:
status: In Progress → Fix Committed
Changed in python-cliff:
milestone: none → 1.11.0
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.