Commit 47a46456 authored by Jason R. Coombs's avatar Jason R. Coombs

Always return a boolean in DirectorySandbox._ok

--HG--
extra : histedit_source : b0072af02db4ba170105a4eb3f8a033dce678869
parent 7a8e4a53
......@@ -200,7 +200,10 @@ class DirectorySandbox(AbstractSandbox):
def __init__(self, sandbox, exceptions=_EXCEPTIONS):
self._sandbox = os.path.normcase(os.path.realpath(sandbox))
self._prefix = os.path.join(self._sandbox,'')
self._exceptions = [os.path.normcase(os.path.realpath(path)) for path in exceptions]
self._exceptions = [
os.path.normcase(os.path.realpath(path))
for path in exceptions
]
AbstractSandbox.__init__(self)
def _violation(self, operation, *args, **kw):
......@@ -225,9 +228,11 @@ class DirectorySandbox(AbstractSandbox):
try:
self._active = False
realpath = os.path.normcase(os.path.realpath(path))
if (self._exempted(realpath) or realpath == self._sandbox
or realpath.startswith(self._prefix)):
return True
return (
self._exempted(realpath)
or realpath == self._sandbox
or realpath.startswith(self._prefix)
)
finally:
self._active = active
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment