summaryrefslogtreecommitdiff
path: root/django/utils/autoreload.py
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2020-11-25 20:39:54 +0100
committerGitHub <noreply@github.com>2020-11-25 20:39:54 +0100
commitaade2b461acafd16cfc82449b3df88a0f1c1c197 (patch)
treef31c68c7810c4b04d34ecb3d93a6c6b6801237a2 /django/utils/autoreload.py
parentfe6e5824218bab7cf47dee112d68325b338f9947 (diff)
Fixed #32223 -- Removed strict=True in Path.resolve() in autoreloader.
This reverts commit e28671187903e6aca2428374fdd504fca3032aee which caused permission errors when users didn't have permissions to all intermediate directories in a Django installation path. Thanks Jakub SzafraƄski for the report.
Diffstat (limited to 'django/utils/autoreload.py')
-rw-r--r--django/utils/autoreload.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py
index 4c7e605b4a..b8efb9f881 100644
--- a/django/utils/autoreload.py
+++ b/django/utils/autoreload.py
@@ -149,15 +149,15 @@ def iter_modules_and_files(modules, extra_files):
continue
path = Path(filename)
try:
- resolved_path = path.resolve(strict=True).absolute()
- except FileNotFoundError:
- # The module could have been removed, don't fail loudly if this
- # is the case.
- continue
+ if not path.exists():
+ # The module could have been removed, don't fail loudly if this
+ # is the case.
+ continue
except ValueError as e:
# Network filesystems may return null bytes in file paths.
logger.debug('"%s" raised when resolving path: "%s"', e, path)
continue
+ resolved_path = path.resolve().absolute()
results.add(resolved_path)
return frozenset(results)
@@ -200,10 +200,9 @@ def sys_path_directories():
"""
for path in sys.path:
path = Path(path)
- try:
- resolved_path = path.resolve(strict=True).absolute()
- except FileNotFoundError:
+ if not path.exists():
continue
+ resolved_path = path.resolve().absolute()
# If the path is a file (like a zip file), watch the parent directory.
if resolved_path.is_file():
yield resolved_path.parent