summaryrefslogtreecommitdiffhomepage
path: root/libs/fcache/cache.py
diff options
context:
space:
mode:
authormorpheus65535 <[email protected]>2023-03-12 19:51:04 -0400
committermorpheus65535 <[email protected]>2023-03-12 19:51:04 -0400
commitfb6ac47bea64c5715672e4f11be8ffc1e02e32bf (patch)
tree43bfe6a4aea3177cd9687326a1f6d645d6faa83f /libs/fcache/cache.py
parent587af7d138f1b11e034c16a70b1032a8932cc59c (diff)
downloadbazarr-fb6ac47bea64c5715672e4f11be8ffc1e02e32bf.tar.gz
bazarr-fb6ac47bea64c5715672e4f11be8ffc1e02e32bf.zip
Fixed permissions issue with cache file. #2084v1.2.1-beta.2
Diffstat (limited to 'libs/fcache/cache.py')
-rw-r--r--libs/fcache/cache.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/libs/fcache/cache.py b/libs/fcache/cache.py
index f6f1d9cb2..32a8a769b 100644
--- a/libs/fcache/cache.py
+++ b/libs/fcache/cache.py
@@ -40,7 +40,7 @@ class FileCache(MutableMapping):
:param str appname: The app/script the cache should be associated with.
:param str flag: How the cache should be opened. See below for details.
- :param mode: The Unix mode for the cache files.
+ :param mode: The Unix mode for the cache files or False to prevent changing permissions.
:param str keyencoding: The encoding the keys use, defaults to 'utf-8'.
This is used if *serialize* is ``False``; the keys are treated as
:class:`bytes` objects.
@@ -247,7 +247,8 @@ class FileCache(MutableMapping):
with os.fdopen(fh, self._flag) as f:
f.write(self._dumps(bytesvalue))
rename(tmp, filename)
- os.chmod(filename, self._mode)
+ if self._mode:
+ os.chmod(filename, self._mode)
def _read_from_file(self, filename):
"""Read data from filename."""
@@ -256,7 +257,7 @@ class FileCache(MutableMapping):
return self._loads(f.read())
except (IOError, OSError):
logger.warning('Error opening file: {}'.format(filename))
- raise
+ return None
def __setitem__(self, key, value):
ekey = self._encode_key(key)