Преглед изворни кода

Ignore configuration file if access denied

Fixes #1215
Bug was introduced in 4c44940ec12a9178efc0cffcd5b0cc61bec3f39a
Unrud пре 4 година
родитељ
комит
11dd0e9380
1 измењених фајлова са 2 додато и 1 уклоњено
  1. 2 1
      radicale/config.py

+ 2 - 1
radicale/config.py

@@ -283,7 +283,8 @@ def load(paths: Optional[Iterable[Tuple[str, bool]]] = None
                 config = {s: {o: parser[s][o] for o in parser.options(s)}
                 config = {s: {o: parser[s][o] for o in parser.options(s)}
                           for s in parser.sections()}
                           for s in parser.sections()}
         except Exception as e:
         except Exception as e:
-            if not ignore_if_missing or not isinstance(e, FileNotFoundError):
+            if not (ignore_if_missing and
+                    isinstance(e, (FileNotFoundError, PermissionError))):
                 raise RuntimeError("Failed to load %s: %s" % (config_source, e)
                 raise RuntimeError("Failed to load %s: %s" % (config_source, e)
                                    ) from e
                                    ) from e
             config = Configuration.SOURCE_MISSING
             config = Configuration.SOURCE_MISSING