No subject
Fri Dec 18 02:33:18 GMT 2009
class cmd_switch(bzrlib.builtins.cmd_switch):
__doc__ =3D bzrlib.builtins.cmd_switch.__doc__
def run(**kwargs):
self.outf.write('Hello World!'\n)
super(cmd_switch, self).run(**kwargs)
but it seems to me that doesn't take into account the fact that switch may =
be=20
overriden by other plugins. So it seems the result of that may be a bit=20
random, depending on which plugin is loaded first?
Then I also saw this done in the loom plugin:
class cmd_switch(bzrlib.builtins.cmd_switch):
def run_argv_aliases(self, argv, alias_argv=3DNone):
try:
super(cmd_switch, self).run_argv_aliases(list(argv), alias_argv)
except (errors.MustUseDecorated, errors.BzrOptionsError):
if self._original_command is None:
raise
self._original_command().run_argv_aliases(argv, alias_argv)
so, IIUC this uses the original command (returned by=20
bzrlib.commands.plugin_cmds.register) stored in _original_command attribute=
,=20
tries to run the overriden command and in case of problems falls back to=20
original command, yes?
Is this the more "proper" way? Does it have to be done in run_argv_aliases=
? =20
I.e. if I'm only adding certain functionality it would be bit more convenie=
nt=20
to do it in run.
I'll try to update http://doc.bazaar.canonical.com/plugins/en/plugin-
development.html#extending-an-existing-command if I can figure out somethin=
g=20
solid to add there.
Thanks,
Michael
--=20
Michael Gliwinski
Henderson Group Information Services
9-11 Hightown Avenue, Newtownabby, BT36 4RT
Phone: 028 9034 3319
***************************************************************************=
*******************
The information in this email is confidential and may be legally privileged=
. It is intended solely for the addressee and access to the email by anyon=
e else is unauthorised.
If you are not the intended recipient, any disclosure, copying, distributio=
n or any action taken or omitted to be taken in reliance on it, is prohibit=
ed and may be unlawful.
When addressed to our clients, any opinions or advice contained in this e-m=
ail are subject to the terms and conditions expressed in the governing cli=
ent engagement leter or contract.
If you have received this email in error please notify support at henderson-gr=
oup.com
John Henderson (Holdings) Ltd
Registered office: 9 Hightown Avenue, Mallusk, County Antrim, Northern Irel=
and, BT36 4RT.
Registered in Northern Ireland
Registration Number NI010588
Vat No.: 814 6399 12
***************************************************************************=
******
More information about the bazaar
mailing list