Change _is_file to return booleans and never raise anything.

feature/documentation-builds-dirhtml
Isis Lovecruft 2013-03-16 02:02:54 +00:00 committed by Isis Lovecruft
parent babff61ec2
commit 058c6f6ca8
1 changed files with 5 additions and 4 deletions

View File

@ -554,11 +554,12 @@ def _is_file(input):
:func:`os.path.isfile`.
"""
try:
assert os.lstat(input).st_size > 0, "not a file"
except AssertionError as ae:
raise ProtectedOption(ae.message)
except TypeError:
assert os.lstat(input).st_size > 0, "not a file: %s" % input
except (AssertionError, TypeError) as error:
logger.debug(error.message)
return False
else:
return True
def _has_readwrite(path):
"""