[enh] Prepend a message with argument name on check pattern failure

This commit is contained in:
Jérôme Lebleu 2014-06-07 14:32:51 +02:00
parent 5d12977f10
commit e66188ecc3
3 changed files with 4 additions and 1 deletions

View file

@ -15,6 +15,7 @@
"ldap_attribute_already_exists" : "Attribute already exists: '{:s}={:s}'",
"argument_required" : "Argument {:s} is required",
"invalid_argument": "Invalid argument '{:s}': {:s}",
"password" : "Password",
"invalid_password" : "Invalid password",
"confirm" : "Confirm {:s}",

View file

@ -15,6 +15,7 @@
"ldap_attribute_already_exists" : "L'attribut existe déjà : '{:s}={:s}'",
"argument_required" : "L'argument {:s} est requis",
"invalid_argument": "Argument '{:s}' incorrect : {:s}",
"password" : "Mot de passe",
"invalid_password" : "Mot de passe incorrect",
"confirm" : "Confirmez le {:s}",

View file

@ -152,7 +152,8 @@ class PatternParameter(_ExtraParameter):
v = arg_value
if v and not re.match(pattern, v or '', re.UNICODE):
raise MoulinetteError(errno.EINVAL, m18n.n(message))
raise MoulinetteError(errno.EINVAL, m18n.g('invalid_argument',
arg_name, m18n.n(message)))
return arg_value
@staticmethod