[MERGE][Trivial] Update automatic plugin management errors
John Arbash Meinel
john at arbash-meinel.com
Fri Jun 6 14:29:46 BST 2008
John Arbash Meinel has voted resubmit.
Status is now: Resubmit
Comment:
I believe we always put the _fmt variable *before* __init__.
And for CommandAvailableInPlugin, why do you have to re-implement
__str__. It seems like you could just do:
class CommandAvailableInPlugin(StandardError):
internal_error = False
_fmt = ('%(cmd_name)r is not a standard bzr command.\n'
'However, the following official plugin provides this
command: %(plugin_name)s\n'
'You can install it by running: bzr install-plugin
%(plugin_name)s\n'
)
def __init__(self, cmd_name, plugin_metadata, provider):
self.plugin_metadata = plugin_metadata
self.cmd_name = cmd_name
self.provider = provider
self.plugin_name = plugin_metadata['name']
self.plugin_url = plugin_metadata['url']
Also, if 'install-plugin' is not in bzr core, I don't want to have an
exception in core that is telling people to run that command.
You can always have your plugin patch the _fmt string. Or at least you
could if you used a normal format string like the rest of the errors.
(That is *much* cleaner that monkey patching the __str__() function at
run time.)
For details, see:
http://bundlebuggy.aaronbentley.com/request/%3C2422be180805260006l339ece00wbc189ca807f6f1b9%40mail.gmail.com%3E
More information about the bazaar
mailing list