better error message with requirementerror

This commit is contained in:
Emmanuel Garette 2017-05-05 21:44:47 +02:00
parent 1ee7d500dd
commit b4cab93e85
3 changed files with 64 additions and 53 deletions

View File

@ -673,12 +673,16 @@ class Settings(object):
continue continue
properties = value.proptype properties = value.proptype
if same_action and action not in properties: # pragma: optional cover if same_action and action not in properties: # pragma: optional cover
raise RequirementError(_("option '{0}' has " if len(properties) == 1:
"requirement's property " prop_msg = _('property')
"error: " else:
"{1} {2}").format(opt._name, prop_msg = _('properties')
reqpath, raise RequirementError(_('cannot access to option "{0}" because '
properties)) '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 orig_value = value
# transitive action, force expected # transitive action, force expected
value = expected[0] value = expected[0]

View File

@ -2,7 +2,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Tiramisu\n" "Project-Id-Version: Tiramisu\n"
"Report-Msgid-Bugs-To: \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" "PO-Revision-Date: \n"
"Last-Translator: Emmanuel Garette <egarette@cadoles.com>\n" "Last-Translator: Emmanuel Garette <egarette@cadoles.com>\n"
"Language-Team: Tiramisu's team <egarette@cadoles.com>\n" "Language-Team: Tiramisu's team <egarette@cadoles.com>\n"
@ -48,7 +48,7 @@ msgid "unknown group_type: {0}"
msgstr "group_type inconnu: {0}" msgstr "group_type inconnu: {0}"
#: tiramisu/config.py:187 tiramisu/setting.py:338 tiramisu/value.py:54 #: 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" msgid "the context does not exist anymore"
msgstr "le context n'existe plus" msgstr "le context n'existe plus"
@ -149,11 +149,11 @@ msgstr "ou"
msgid " {} " msgid " {} "
msgstr " {} " msgstr " {} "
#: tiramisu/error.py:81 tiramisu/setting.py:517 #: tiramisu/error.py:81 tiramisu/setting.py:517 tiramisu/setting.py:677
msgid "property" msgid "property"
msgstr "de la propriété" 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" msgid "properties"
msgstr "des propriétés" msgstr "des propriétés"
@ -431,7 +431,7 @@ msgstr ""
"callback d'une variable maitre ne devrait pas référencer des variables " "callback d'une variable maitre ne devrait pas référencer des variables "
"esclaves" "esclaves"
#: tiramisu/option/masterslave.py:274 #: tiramisu/option/masterslave.py:277
msgid "invalid len for the slave: {0} which has {1} as master" 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" msgstr "longueur invalide pour une esclave : {0} qui a {1} comme maître"
@ -794,11 +794,11 @@ msgstr ""
msgid "permissive must be a tuple" msgid "permissive must be a tuple"
msgstr "permissive doit être un 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}" msgid "invalid generic owner {0}"
msgstr "invalide owner générique {0}" msgstr "invalide owner générique {0}"
#: tiramisu/setting.py:650 #: tiramisu/setting.py:651
msgid "" msgid ""
"malformed requirements imbrication detected for option: '{0}' with " "malformed requirements imbrication detected for option: '{0}' with "
"requirement on: '{1}'" "requirement on: '{1}'"
@ -806,15 +806,18 @@ msgstr ""
"imbrication de requirements mal formés detectée pour l'option : '{0}' avec " "imbrication de requirements mal formés detectée pour l'option : '{0}' avec "
"requirement sur : '{1}'" "requirement sur : '{1}'"
#: tiramisu/setting.py:675 #: tiramisu/setting.py:680
msgid "option '{0}' has requirement's property error: {1} {2}" msgid ""
msgstr "l'option '{0}' a une erreur de propriété pour le requirement : {1} {2}" "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}\"" msgid "the value of \"{0}\" is \"{1}\""
msgstr "la valeur de \"{0}\" est \"{1}\"" msgstr "la valeur de \"{0}\" est \"{1}\""
#: tiramisu/setting.py:699 #: tiramisu/setting.py:704
msgid "the value of \"{0}\" is not \"{1}\"" msgid "the value of \"{0}\" is not \"{1}\""
msgstr "la valeur de \"{0}\" n'est pas \"{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}" msgid "information's item not found {0}"
msgstr "l'information de l'objet ne sont pas trouvé {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" msgid "you should only set value with config"
msgstr "vous devez seul affecter une valeur avec un 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" msgid "owner only avalaible for an option"
msgstr "owner seulement possible pour une 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}" msgid "no value for {0} cannot change owner to {1}"
msgstr "pas de valeur pour {0} ne peut changer d'utilisateur pour {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" msgid "can force cache only if cache is actived in config"
msgstr "" msgstr ""
"peut force la mise en cache seulement si le cache est activé dans la config" "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 " msgid "{0} is already a Multi "
msgstr "{0} est déjà une 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" 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" 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" 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" 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" msgid "cmp is not permitted in python v3 or greater"
msgstr "cmp n'est pas permis en python v3 ou supérieure" 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" 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" 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" 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" 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" 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" 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" 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" 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" #~ msgid "cannot change the value for option {0} this option is frozen"
#~ msgstr "" #~ msgstr ""
#~ "ne peut modifier la valeur de l'option {0} cette option n'est pas " #~ "ne peut modifier la valeur de l'option {0} cette option n'est pas "

View File

@ -5,7 +5,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "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" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -40,7 +40,7 @@ msgid "unknown group_type: {0}"
msgstr "" msgstr ""
#: tiramisu/config.py:187 tiramisu/setting.py:338 tiramisu/value.py:54 #: 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" msgid "the context does not exist anymore"
msgstr "" msgstr ""
@ -132,11 +132,11 @@ msgstr ""
msgid " {} " msgid " {} "
msgstr "" msgstr ""
#: tiramisu/error.py:81 tiramisu/setting.py:517 #: tiramisu/error.py:81 tiramisu/setting.py:517 tiramisu/setting.py:677
msgid "property" msgid "property"
msgstr "" msgstr ""
#: tiramisu/error.py:83 tiramisu/setting.py:519 #: tiramisu/error.py:83 tiramisu/setting.py:519 tiramisu/setting.py:679
msgid "properties" msgid "properties"
msgstr "" msgstr ""
@ -376,7 +376,7 @@ msgstr ""
msgid "callback of master's option shall not refered a slave's ones" msgid "callback of master's option shall not refered a slave's ones"
msgstr "" msgstr ""
#: tiramisu/option/masterslave.py:274 #: tiramisu/option/masterslave.py:277
msgid "invalid len for the slave: {0} which has {1} as master" msgid "invalid len for the slave: {0} which has {1} as master"
msgstr "" msgstr ""
@ -721,23 +721,23 @@ msgstr ""
msgid "permissive must be a tuple" msgid "permissive must be a tuple"
msgstr "" msgstr ""
#: tiramisu/setting.py:549 tiramisu/value.py:549 #: tiramisu/setting.py:550 tiramisu/value.py:550
msgid "invalid generic owner {0}" msgid "invalid generic owner {0}"
msgstr "" msgstr ""
#: tiramisu/setting.py:650 #: tiramisu/setting.py:651
msgid "malformed requirements imbrication detected for option: '{0}' with requirement on: '{1}'" msgid "malformed requirements imbrication detected for option: '{0}' with requirement on: '{1}'"
msgstr "" msgstr ""
#: tiramisu/setting.py:675 #: tiramisu/setting.py:680
msgid "option '{0}' has requirement's property error: {1} {2}" msgid "cannot access to option \"{0}\" because required option \"{1}\" has {2} {3}"
msgstr "" msgstr ""
#: tiramisu/setting.py:697 #: tiramisu/setting.py:702
msgid "the value of \"{0}\" is \"{1}\"" msgid "the value of \"{0}\" is \"{1}\""
msgstr "" msgstr ""
#: tiramisu/setting.py:699 #: tiramisu/setting.py:704
msgid "the value of \"{0}\" is not \"{1}\"" msgid "the value of \"{0}\" is not \"{1}\""
msgstr "" msgstr ""
@ -813,51 +813,51 @@ msgstr ""
msgid "information's item not found {0}" msgid "information's item not found {0}"
msgstr "" msgstr ""
#: tiramisu/value.py:397 #: tiramisu/value.py:398
msgid "you should only set value with config" msgid "you should only set value with config"
msgstr "" msgstr ""
#: tiramisu/value.py:509 #: tiramisu/value.py:510
msgid "owner only avalaible for an option" msgid "owner only avalaible for an option"
msgstr "" msgstr ""
#: tiramisu/value.py:554 #: tiramisu/value.py:555
msgid "no value for {0} cannot change owner to {1}" msgid "no value for {0} cannot change owner to {1}"
msgstr "" msgstr ""
#: tiramisu/value.py:686 #: tiramisu/value.py:687
msgid "can force cache only if cache is actived in config" msgid "can force cache only if cache is actived in config"
msgstr "" msgstr ""
#: tiramisu/value.py:723 #: tiramisu/value.py:724
msgid "{0} is already a Multi " msgid "{0} is already a Multi "
msgstr "" msgstr ""
#: tiramisu/value.py:806 #: tiramisu/value.py:807
msgid "cannot append a value on a multi option {0} which is a slave" msgid "cannot append a value on a multi option {0} which is a slave"
msgstr "" msgstr ""
#: tiramisu/value.py:839 #: tiramisu/value.py:840
msgid "cannot sort multi option {0} if master or slave" msgid "cannot sort multi option {0} if master or slave"
msgstr "" msgstr ""
#: tiramisu/value.py:843 #: tiramisu/value.py:844
msgid "cmp is not permitted in python v3 or greater" msgid "cmp is not permitted in python v3 or greater"
msgstr "" msgstr ""
#: tiramisu/value.py:852 #: tiramisu/value.py:853
msgid "cannot reverse multi option {0} if master or slave" msgid "cannot reverse multi option {0} if master or slave"
msgstr "" msgstr ""
#: tiramisu/value.py:859 #: tiramisu/value.py:860
msgid "cannot insert multi option {0} if master or slave" msgid "cannot insert multi option {0} if master or slave"
msgstr "" msgstr ""
#: tiramisu/value.py:876 #: tiramisu/value.py:877
msgid "cannot extend multi option {0} if master or slave" msgid "cannot extend multi option {0} if master or slave"
msgstr "" msgstr ""
#: tiramisu/value.py:916 #: tiramisu/value.py:917
msgid "cannot pop a value on a multi option {0} which is a slave" msgid "cannot pop a value on a multi option {0} which is a slave"
msgstr "" msgstr ""