mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
[enh] Allow unicode pattern matching in 'pattern' extra parameter
This commit is contained in:
parent
735ca3af87
commit
1a313a792c
1 changed files with 7 additions and 1 deletions
|
@ -145,7 +145,13 @@ class PatternParameter(_ExtraParameter):
|
|||
def __call__(self, arguments, arg_name, arg_value):
|
||||
pattern, message = (arguments[0], arguments[1])
|
||||
|
||||
if arg_value and not re.match(pattern, arg_value or ''):
|
||||
# Use temporarly utf-8 encoded value
|
||||
try:
|
||||
v = unicode(arg_value, 'utf-8')
|
||||
except:
|
||||
v = arg_value
|
||||
|
||||
if v and not re.match(pattern, v or '', re.UNICODE):
|
||||
raise MoulinetteError(errno.EINVAL, m18n.n(message))
|
||||
return arg_value
|
||||
|
||||
|
|
Loading…
Reference in a new issue