changed the over.callback.path API some more

This commit is contained in:
Martin Sekera 2019-04-18 02:18:15 +02:00
parent cf9fda165f
commit 908857a317
2 changed files with 14 additions and 3 deletions

View file

@ -87,7 +87,18 @@ def path(exists=False, permissions=None, validators=None):
raise PermissionError("%s is not executable" %(arg))
if validators:
for fn, msg_tpl in validators:
if hasattr(validators, "__iter__"):
src = validators
else:
src = [validators]
for v in src:
if hasattr(v, "__iter__"):
fn, msg_tpl = v
else:
fn = v
msg_tpl = "%%s failed validation by '%s'" %(fn.__name__)
if not fn(path):
msg = msg_tpl %(arg) if "%s" in msg_tpl else msg_tpl

View file

@ -4,5 +4,5 @@
major = 2 # VERSION_MAJOR_IDENTIFIER
minor = 1 # VERSION_MINOR_IDENTIFIER
# VERSION_LAST_MM 2.1
patch = 3 # VERSION_PATCH_IDENTIFIER
str = "2.1.3" # VERSION_STRING_IDENTIFIER
patch = 4 # VERSION_PATCH_IDENTIFIER
str = "2.1.4" # VERSION_STRING_IDENTIFIER