changed the over.callback.path API some more
This commit is contained in:
parent
cf9fda165f
commit
908857a317
2 changed files with 14 additions and 3 deletions
|
@ -87,7 +87,18 @@ def path(exists=False, permissions=None, validators=None):
|
||||||
raise PermissionError("%s is not executable" %(arg))
|
raise PermissionError("%s is not executable" %(arg))
|
||||||
|
|
||||||
if validators:
|
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):
|
if not fn(path):
|
||||||
msg = msg_tpl %(arg) if "%s" in msg_tpl else msg_tpl
|
msg = msg_tpl %(arg) if "%s" in msg_tpl else msg_tpl
|
||||||
|
|
||||||
|
|
|
@ -4,5 +4,5 @@
|
||||||
major = 2 # VERSION_MAJOR_IDENTIFIER
|
major = 2 # VERSION_MAJOR_IDENTIFIER
|
||||||
minor = 1 # VERSION_MINOR_IDENTIFIER
|
minor = 1 # VERSION_MINOR_IDENTIFIER
|
||||||
# VERSION_LAST_MM 2.1
|
# VERSION_LAST_MM 2.1
|
||||||
patch = 3 # VERSION_PATCH_IDENTIFIER
|
patch = 4 # VERSION_PATCH_IDENTIFIER
|
||||||
str = "2.1.3" # VERSION_STRING_IDENTIFIER
|
str = "2.1.4" # VERSION_STRING_IDENTIFIER
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue