diff options
author | Joshua Harlow <harlowja@gmail.com> | 2015-05-23 13:50:43 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@yahoo-inc.com> | 2015-06-10 18:04:59 +0000 |
commit | deaf61caac32961266e2d0644ad4312ea2dcd867 (patch) | |
tree | 8861d36221394364f6b8b532da20556a438dc8bb | |
parent | 33e9ccc42566f4b666e04c1291bf01539288ffaf (diff) | |
download | taskflow-deaf61caac32961266e2d0644ad4312ea2dcd867.tar.gz |
Make the default file encoding a class constant with a docstring
Having this exposed makes it easier to know what it is being
used for and what the default is (and also makes it show up
in generated docs, so people can read all about it).
Change-Id: I2e0f85d9c087d220671e2dbf82d497677c462a9e
-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) |