summaryrefslogtreecommitdiff
path: root/taskflow/persistence
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-06-14 18:42:30 +0000
committerGerrit Code Review <review@openstack.org>2015-06-14 18:42:30 +0000
commita6126941af4c2493188bd3db6e925d427b6b13f1 (patch)
tree1eda6d7daa6e127801f39ecfe6026002e809def5 /taskflow/persistence
parent1c036998ca47222fe34fa53124c3df041ceb050c (diff)
parentdeaf61caac32961266e2d0644ad4312ea2dcd867 (diff)
downloadtaskflow-a6126941af4c2493188bd3db6e925d427b6b13f1.tar.gz
Merge "Make the default file encoding a class constant with a docstring"
Diffstat (limited to 'taskflow/persistence')
-rw-r--r--taskflow/persistence/backends/impl_dir.py8
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)