[enh] Better confirmation prompting

This commit is contained in:
Jérôme Lebleu 2014-06-02 21:03:08 +02:00
parent 7145039e89
commit 594a1a3c32
3 changed files with 4 additions and 3 deletions

View file

@ -17,7 +17,7 @@
"argument_required" : "Argument {:s} is required",
"password" : "Password",
"invalid_password" : "Invalid password",
"confirm" : "Confirm",
"confirm" : "Confirm {:s}",
"values_mismatch" : "Values don't match",
"authentication_required_long" : "Authentication is required to perform this action",
"authentication_required" : "Authentication required",

View file

@ -17,7 +17,7 @@
"argument_required" : "L'argument {:s} est requis",
"password" : "Mot de passe",
"invalid_password" : "Mot de passe incorrect",
"confirm" : "Confirmez",
"confirm" : "Confirmez le {:s}",
"values_mismatch" : "Les valeurs ne correspondent pas",
"authentication_required_long" : "L'authentification est requise pour exécuter cette action",
"authentication_required" : "Authentification requise",

View file

@ -239,7 +239,8 @@ class Interface(BaseInterface):
value = prompt(message)
if confirm:
if prompt('%s %s' % (m18n.g('confirm'), message)) != value:
m = message[0].lower() + message[1:]
if prompt(m18n.g('confirm', m)) != value:
raise MoulinetteError(errno.EINVAL, m18n.g('values_mismatch'))
return value