Throw TypeError on invalid destination, add _metadata_path attribute

This commit is contained in:
Eric Torres 2019-03-28 12:07:31 -07:00
parent aea24e2b6e
commit 0ccb6764cd

View File

@ -3,8 +3,13 @@
.. module:: rbackup.hierarchy.hierarchy .. module:: rbackup.hierarchy.hierarchy
:synopsis: Classes for creating the backup hierarchy. :synopsis: Classes for creating the backup hierarchy.
""" """
import logging
from pathlib import Path from pathlib import Path
# ========== Logging Setup ===========
syslog = logging.getLogger(__name__)
# ========== Classes ========== # ========== Classes ==========
class Hierarchy: class Hierarchy:
@ -32,7 +37,12 @@ class Hierarchy:
:param dest: the root directory of the backup hierarchy :param dest: the root directory of the backup hierarchy
:type dest: str, path-like object :type dest: str, path-like object
""" """
self._path = Path(dest) try:
self._path = Path(dest)
except TypeError as e:
raise e
self._metadata_path = self.path / ".metadata"
@property @property
def path(self): def path(self):