fix callback.path ignoring the 'exists' attr on writable paths
This commit is contained in:
parent
3f6b7cd24e
commit
2645383a6f
2 changed files with 10 additions and 4 deletions
|
@ -81,8 +81,14 @@ def path(exists=False, permissions=None, validators=None):
|
|||
if permissions:
|
||||
if "r" in permissions and not os.access(path, os.R_OK):
|
||||
raise PermissionError("%s is not readable" %(arg))
|
||||
if "w" in permissions and not os.access(path, os.W_OK):
|
||||
raise PermissionError("%s is not writable" %(arg))
|
||||
|
||||
if exists or os.path.exists(path):
|
||||
if "w" in permissions and not os.access(path, os.W_OK):
|
||||
raise PermissionError("%s is not writable" %(arg))
|
||||
else:
|
||||
if "w" in permissions and not os.access(os.path.dirname(path), os.W_OK):
|
||||
raise PermissionError("%s cannot be created" %(arg))
|
||||
|
||||
if "x" in permissions and not os.access(path, os.X_OK):
|
||||
raise PermissionError("%s is not executable" %(arg))
|
||||
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
major = 2 # VERSION_MAJOR_IDENTIFIER
|
||||
minor = 1 # VERSION_MINOR_IDENTIFIER
|
||||
# VERSION_LAST_MM 2.1
|
||||
patch = 9 # VERSION_PATCH_IDENTIFIER
|
||||
str = "2.1.9" # VERSION_STRING_IDENTIFIER
|
||||
patch = 10 # VERSION_PATCH_IDENTIFIER
|
||||
str = "2.1.10" # VERSION_STRING_IDENTIFIER
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue