Merge "Use a class constant for the default path based backend path"
This commit is contained in:
commit
68f3fd04c6
@ -308,10 +308,12 @@ class MemoryBackend(path_based.PathBasedBackend):
|
|||||||
guarantee that there will be no inter-thread race conditions when
|
guarantee that there will be no inter-thread race conditions when
|
||||||
writing and reading by using a read/write locks.
|
writing and reading by using a read/write locks.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
#: Default path used when none is provided.
|
||||||
|
DEFAULT_PATH = pp.sep
|
||||||
|
|
||||||
def __init__(self, conf=None):
|
def __init__(self, conf=None):
|
||||||
super(MemoryBackend, self).__init__(conf)
|
super(MemoryBackend, self).__init__(conf)
|
||||||
if self._path is None:
|
|
||||||
self._path = pp.sep
|
|
||||||
self.memory = FakeFilesystem(deep_copy=self._conf.get('deep_copy',
|
self.memory = FakeFilesystem(deep_copy=self._conf.get('deep_copy',
|
||||||
True))
|
True))
|
||||||
self.lock = fasteners.ReaderWriterLock()
|
self.lock = fasteners.ReaderWriterLock()
|
||||||
|
@ -40,10 +40,12 @@ class ZkBackend(path_based.PathBasedBackend):
|
|||||||
"path": "/taskflow",
|
"path": "/taskflow",
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
#: Default path used when none is provided.
|
||||||
|
DEFAULT_PATH = '/taskflow'
|
||||||
|
|
||||||
def __init__(self, conf, client=None):
|
def __init__(self, conf, client=None):
|
||||||
super(ZkBackend, self).__init__(conf)
|
super(ZkBackend, self).__init__(conf)
|
||||||
if not self._path:
|
|
||||||
self._path = '/taskflow'
|
|
||||||
if not paths.isabs(self._path):
|
if not paths.isabs(self._path):
|
||||||
raise ValueError("Zookeeper path must be absolute")
|
raise ValueError("Zookeeper path must be absolute")
|
||||||
if client is not None:
|
if client is not None:
|
||||||
|
@ -34,9 +34,14 @@ class PathBasedBackend(base.Backend):
|
|||||||
the contents of those objects for later reading and writing.
|
the contents of those objects for later reading and writing.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
#: Default path used when none is provided.
|
||||||
|
DEFAULT_PATH = None
|
||||||
|
|
||||||
def __init__(self, conf):
|
def __init__(self, conf):
|
||||||
super(PathBasedBackend, self).__init__(conf)
|
super(PathBasedBackend, self).__init__(conf)
|
||||||
self._path = self._conf.get('path', None)
|
self._path = self._conf.get('path', None)
|
||||||
|
if not self._path:
|
||||||
|
self._path = self.DEFAULT_PATH
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def path(self):
|
def path(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user