From b7a2a42d9c9c166dd2629c1c93e8d346d41f3763 Mon Sep 17 00:00:00 2001 From: Diego Moreda Date: Thu, 28 Jan 2016 13:01:44 +0100 Subject: [PATCH] Fix docs on plugin prompt choices conflict solving * Fix docstring and `plugins.rst` regarding how the PromptChoices that use the same short letter are handled (they are discarded instead of raising an Exception). --- beets/ui/commands.py | 4 +++- docs/dev/plugins.rst | 9 +++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/beets/ui/commands.py b/beets/ui/commands.py index 3e3acb7c3..41f118bc6 100644 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -853,7 +853,9 @@ class TerminalImportSession(importer.ImportSession): checking the right conditions and returning a list of `PromptChoice`s, which is flattened and checked for conflicts. - Raises `ValueError` if two of the choices have the same short letter. + If two or more choices have the same short letter, a warning is + emitted and all but one choices are discarded, giving preference + to the default importer choices. Returns a list of `PromptChoice`s. """ diff --git a/docs/dev/plugins.rst b/docs/dev/plugins.rst index b7c5d82f9..80409d5f5 100644 --- a/docs/dev/plugins.rst +++ b/docs/dev/plugins.rst @@ -585,10 +585,11 @@ album has no candidates, the relevant checks against ``task.candidates`` should be performed inside the plugin's ``before_choose_candidate_event`` accordingly. Please make sure that the short letter for each of the choices provided by the -plugin is not already in use: the importer will raise an exception if two or -more choices try to use the same short letter. As a reference, the following -characters are used by the choices on the core importer prompt, and hence -should not be used: ``a``, ``s``, ``u``, ``t``, ``g``, ``e``, ``i``, ``b``. +plugin is not already in use: the importer will emit a warning and discard +all but one of the choices using the same letter, giving priority to the +core importer prompt choices. As a reference, the following characters are used +by the choices on the core importer prompt, and hence should not be used: +``a``, ``s``, ``u``, ``t``, ``g``, ``e``, ``i``, ``b``. Additionally, the callback function can optionally specify the next action to be performed by returning one of the values from ``importer.action``, which