From b4cab93e85ff9350eb10b0aa3a5c7a5669db91cb Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Fri, 5 May 2017 21:44:47 +0200 Subject: [PATCH] better error message with requirementerror --- tiramisu/setting.py | 16 +++++++---- translations/fr/tiramisu.po | 55 +++++++++++++++++++++---------------- translations/tiramisu.pot | 46 +++++++++++++++---------------- 3 files changed, 64 insertions(+), 53 deletions(-) diff --git a/tiramisu/setting.py b/tiramisu/setting.py index 74d2322..5ed3a16 100644 --- a/tiramisu/setting.py +++ b/tiramisu/setting.py @@ -673,12 +673,16 @@ class Settings(object): continue properties = value.proptype if same_action and action not in properties: # pragma: optional cover - raise RequirementError(_("option '{0}' has " - "requirement's property " - "error: " - "{1} {2}").format(opt._name, - reqpath, - properties)) + if len(properties) == 1: + prop_msg = _('property') + else: + prop_msg = _('properties') + raise RequirementError(_('cannot access to option "{0}" because ' + 'required option "{1}" has {2} {3}' + '').format(opt.impl_get_display_name(), + option.impl_get_display_name(), + prop_msg, + display_list(properties))) orig_value = value # transitive action, force expected value = expected[0] diff --git a/translations/fr/tiramisu.po b/translations/fr/tiramisu.po index 76681f6..6d4945e 100644 --- a/translations/fr/tiramisu.po +++ b/translations/fr/tiramisu.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: Tiramisu\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-04-20 10:15+0200\n" +"POT-Creation-Date: 2017-05-05 21:41+0200\n" "PO-Revision-Date: \n" "Last-Translator: Emmanuel Garette \n" "Language-Team: Tiramisu's team \n" @@ -48,7 +48,7 @@ msgid "unknown group_type: {0}" msgstr "group_type inconnu: {0}" #: tiramisu/config.py:187 tiramisu/setting.py:338 tiramisu/value.py:54 -#: tiramisu/value.py:757 +#: tiramisu/value.py:758 msgid "the context does not exist anymore" msgstr "le context n'existe plus" @@ -149,11 +149,11 @@ msgstr "ou" msgid " {} " msgstr " {} " -#: tiramisu/error.py:81 tiramisu/setting.py:517 +#: tiramisu/error.py:81 tiramisu/setting.py:517 tiramisu/setting.py:677 msgid "property" msgstr "de la propriété" -#: tiramisu/error.py:83 tiramisu/setting.py:519 +#: tiramisu/error.py:83 tiramisu/setting.py:519 tiramisu/setting.py:679 msgid "properties" msgstr "des propriétés" @@ -431,7 +431,7 @@ msgstr "" "callback d'une variable maitre ne devrait pas référencer des variables " "esclaves" -#: tiramisu/option/masterslave.py:274 +#: tiramisu/option/masterslave.py:277 msgid "invalid len for the slave: {0} which has {1} as master" msgstr "longueur invalide pour une esclave : {0} qui a {1} comme maître" @@ -794,11 +794,11 @@ msgstr "" msgid "permissive must be a tuple" msgstr "permissive doit être un tuple" -#: tiramisu/setting.py:549 tiramisu/value.py:549 +#: tiramisu/setting.py:550 tiramisu/value.py:550 msgid "invalid generic owner {0}" msgstr "invalide owner générique {0}" -#: tiramisu/setting.py:650 +#: tiramisu/setting.py:651 msgid "" "malformed requirements imbrication detected for option: '{0}' with " "requirement on: '{1}'" @@ -806,15 +806,18 @@ msgstr "" "imbrication de requirements mal formés detectée pour l'option : '{0}' avec " "requirement sur : '{1}'" -#: tiramisu/setting.py:675 -msgid "option '{0}' has requirement's property error: {1} {2}" -msgstr "l'option '{0}' a une erreur de propriété pour le requirement : {1} {2}" +#: tiramisu/setting.py:680 +msgid "" +"cannot access to option \"{0}\" because required option \"{1}\" has {2} {3}" +msgstr "" +"ne peut accéder à l'option \"{0}\" parce que l'option requise \"{1}\" a {2} " +"{3}" -#: tiramisu/setting.py:697 +#: tiramisu/setting.py:702 msgid "the value of \"{0}\" is \"{1}\"" msgstr "la valeur de \"{0}\" est \"{1}\"" -#: tiramisu/setting.py:699 +#: tiramisu/setting.py:704 msgid "the value of \"{0}\" is not \"{1}\"" msgstr "la valeur de \"{0}\" n'est pas \"{1}\"" @@ -892,55 +895,59 @@ msgstr "un espace de stockage dictionary ne peut être persistant" msgid "information's item not found {0}" msgstr "l'information de l'objet ne sont pas trouvé {0}" -#: tiramisu/value.py:397 +#: tiramisu/value.py:398 msgid "you should only set value with config" msgstr "vous devez seul affecter une valeur avec un config" -#: tiramisu/value.py:509 +#: tiramisu/value.py:510 msgid "owner only avalaible for an option" msgstr "owner seulement possible pour une option" -#: tiramisu/value.py:554 +#: tiramisu/value.py:555 msgid "no value for {0} cannot change owner to {1}" msgstr "pas de valeur pour {0} ne peut changer d'utilisateur pour {1}" -#: tiramisu/value.py:686 +#: tiramisu/value.py:687 msgid "can force cache only if cache is actived in config" msgstr "" "peut force la mise en cache seulement si le cache est activé dans la config" -#: tiramisu/value.py:723 +#: tiramisu/value.py:724 msgid "{0} is already a Multi " msgstr "{0} est déjà une Multi" -#: tiramisu/value.py:806 +#: tiramisu/value.py:807 msgid "cannot append a value on a multi option {0} which is a slave" msgstr "ne peut ajouter une valeur sur l'option multi {0} qui est une esclave" -#: tiramisu/value.py:839 +#: tiramisu/value.py:840 msgid "cannot sort multi option {0} if master or slave" msgstr "ne peut trier une option multi {0} pour une maître ou une esclave" -#: tiramisu/value.py:843 +#: tiramisu/value.py:844 msgid "cmp is not permitted in python v3 or greater" msgstr "cmp n'est pas permis en python v3 ou supérieure" -#: tiramisu/value.py:852 +#: tiramisu/value.py:853 msgid "cannot reverse multi option {0} if master or slave" msgstr "ne peut inverser une option multi {0} pour une maître ou une esclave" -#: tiramisu/value.py:859 +#: tiramisu/value.py:860 msgid "cannot insert multi option {0} if master or slave" msgstr "ne peut insérer une option multi {0} pour une maître ou une esclave" -#: tiramisu/value.py:876 +#: tiramisu/value.py:877 msgid "cannot extend multi option {0} if master or slave" msgstr "ne peut étendre une option multi {0} pour une maître ou une esclave" -#: tiramisu/value.py:916 +#: tiramisu/value.py:917 msgid "cannot pop a value on a multi option {0} which is a slave" msgstr "ne peut supprimer une valeur dans l'option multi {0} qui est esclave" +#~ msgid "option '{0}' has requirement's property error: {1} {2}" +#~ msgstr "" +#~ "l'option '{0}' a une erreur de propriété pour le requirement : {1} {2}" + #~ msgid "cannot change the value for option {0} this option is frozen" #~ msgstr "" #~ "ne peut modifier la valeur de l'option {0} cette option n'est pas " diff --git a/translations/tiramisu.pot b/translations/tiramisu.pot index 21c2fb7..3f1ae00 100644 --- a/translations/tiramisu.pot +++ b/translations/tiramisu.pot @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2017-04-20 10:15+CEST\n" +"POT-Creation-Date: 2017-05-05 21:41+CEST\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -40,7 +40,7 @@ msgid "unknown group_type: {0}" msgstr "" #: tiramisu/config.py:187 tiramisu/setting.py:338 tiramisu/value.py:54 -#: tiramisu/value.py:757 +#: tiramisu/value.py:758 msgid "the context does not exist anymore" msgstr "" @@ -132,11 +132,11 @@ msgstr "" msgid " {} " msgstr "" -#: tiramisu/error.py:81 tiramisu/setting.py:517 +#: tiramisu/error.py:81 tiramisu/setting.py:517 tiramisu/setting.py:677 msgid "property" msgstr "" -#: tiramisu/error.py:83 tiramisu/setting.py:519 +#: tiramisu/error.py:83 tiramisu/setting.py:519 tiramisu/setting.py:679 msgid "properties" msgstr "" @@ -376,7 +376,7 @@ msgstr "" msgid "callback of master's option shall not refered a slave's ones" msgstr "" -#: tiramisu/option/masterslave.py:274 +#: tiramisu/option/masterslave.py:277 msgid "invalid len for the slave: {0} which has {1} as master" msgstr "" @@ -721,23 +721,23 @@ msgstr "" msgid "permissive must be a tuple" msgstr "" -#: tiramisu/setting.py:549 tiramisu/value.py:549 +#: tiramisu/setting.py:550 tiramisu/value.py:550 msgid "invalid generic owner {0}" msgstr "" -#: tiramisu/setting.py:650 +#: tiramisu/setting.py:651 msgid "malformed requirements imbrication detected for option: '{0}' with requirement on: '{1}'" msgstr "" -#: tiramisu/setting.py:675 -msgid "option '{0}' has requirement's property error: {1} {2}" +#: tiramisu/setting.py:680 +msgid "cannot access to option \"{0}\" because required option \"{1}\" has {2} {3}" msgstr "" -#: tiramisu/setting.py:697 +#: tiramisu/setting.py:702 msgid "the value of \"{0}\" is \"{1}\"" msgstr "" -#: tiramisu/setting.py:699 +#: tiramisu/setting.py:704 msgid "the value of \"{0}\" is not \"{1}\"" msgstr "" @@ -813,51 +813,51 @@ msgstr "" msgid "information's item not found {0}" msgstr "" -#: tiramisu/value.py:397 +#: tiramisu/value.py:398 msgid "you should only set value with config" msgstr "" -#: tiramisu/value.py:509 +#: tiramisu/value.py:510 msgid "owner only avalaible for an option" msgstr "" -#: tiramisu/value.py:554 +#: tiramisu/value.py:555 msgid "no value for {0} cannot change owner to {1}" msgstr "" -#: tiramisu/value.py:686 +#: tiramisu/value.py:687 msgid "can force cache only if cache is actived in config" msgstr "" -#: tiramisu/value.py:723 +#: tiramisu/value.py:724 msgid "{0} is already a Multi " msgstr "" -#: tiramisu/value.py:806 +#: tiramisu/value.py:807 msgid "cannot append a value on a multi option {0} which is a slave" msgstr "" -#: tiramisu/value.py:839 +#: tiramisu/value.py:840 msgid "cannot sort multi option {0} if master or slave" msgstr "" -#: tiramisu/value.py:843 +#: tiramisu/value.py:844 msgid "cmp is not permitted in python v3 or greater" msgstr "" -#: tiramisu/value.py:852 +#: tiramisu/value.py:853 msgid "cannot reverse multi option {0} if master or slave" msgstr "" -#: tiramisu/value.py:859 +#: tiramisu/value.py:860 msgid "cannot insert multi option {0} if master or slave" msgstr "" -#: tiramisu/value.py:876 +#: tiramisu/value.py:877 msgid "cannot extend multi option {0} if master or slave" msgstr "" -#: tiramisu/value.py:916 +#: tiramisu/value.py:917 msgid "cannot pop a value on a multi option {0} which is a slave" msgstr ""