diff options
Diffstat (limited to 'taskflow')
-rw-r--r-- | taskflow/persistence/backends/impl_dir.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/taskflow/persistence/backends/impl_dir.py b/taskflow/persistence/backends/impl_dir.py index b6d1a27..1047d67 100644 --- a/taskflow/persistence/backends/impl_dir.py +++ b/taskflow/persistence/backends/impl_dir.py @@ -60,6 +60,12 @@ class DirBackend(path_based.PathBasedBackend): } """ + DEFAULT_FILE_ENCODING = 'utf-8' + """ + Default encoding used when decoding or encoding files into or from + text/unicode into binary or binary into text/unicode. + """ + def __init__(self, conf): super(DirBackend, self).__init__(conf) max_cache_size = self._conf.get('max_cache_size') @@ -71,7 +77,7 @@ class DirBackend(path_based.PathBasedBackend): self.file_cache = cachetools.LRUCache(max_cache_size) else: self.file_cache = {} - self.encoding = self._conf.get('encoding', 'utf-8') + self.encoding = self._conf.get('encoding', self.DEFAULT_FILE_ENCODING) if not self._path: raise ValueError("Empty path is disallowed") self._path = os.path.abspath(self._path) |