calling Command._setup_outf() in run_argv_aliases() prevents from wrapping cmd_log
John Arbash Meinel
john at arbash-meinel.com
Fri Jul 21 19:52:52 BST 2006
Adeodato Simó wrote:
> Hi.
>
> Consider the attached dummy plugin. bzr log2 -r1 works fine with 0.8,
> while with 0.9 gives:
>
> bzr: ERROR: exceptions.AttributeError: 'cmd_log' object has no attribute 'outf'
>
> This is because self._setup_outf() is invoked in run_argv_aliases(),
> which when calling run() from other command is not invoked.
>
> If I'm not mistaken, using other cmd_foo().run() in plugins is not an
> unexpected use of the API, so I wonder if this can be addressed.
>
> Thanks,
>
>
Well, I know bzrtools does this. Though I think it is ugly.
If I was wrapping another command like you are doing, I would do it more as:
class cmd_log2(cmd_log):
def run(self, *opts, **kwargs):
cmd_log.run(self, *opts, **kwargs)
Which means that I am re-using the 'self' object, which has had
'run_argv_aliases' already called on it.
However, we should probably work something out. We might be able to
change the _setup_outf call to occur inside the constructor, instead of
in run_argv_aliases. I'll look into it a bit.
John
=:->
More information about the bazaar
mailing list