[fix] Do not match pattern against empty value

This commit is contained in:
kload 2014-04-24 12:05:12 +00:00
parent 962b78329f
commit 906a416f59

View file

@ -142,7 +142,7 @@ class PatternParameter(_ExtraParameter):
def __call__(self, arguments, arg_name, arg_value):
pattern, message = (arguments[0], arguments[1])
if not re.match(pattern, arg_value or ''):
if arg_value and not re.match(pattern, arg_value or ''):
raise MoulinetteError(errno.EINVAL, message)
return arg_value