Minor fixes
This commit is contained in:
parent
e4042f3a11
commit
468336e894
|
@ -38,7 +38,7 @@ class ConfigDirectoryContext():
|
||||||
filename = f'{filename}.json'
|
filename = f'{filename}.json'
|
||||||
fpath = os.path.join(self.path, filename)
|
fpath = os.path.join(self.path, filename)
|
||||||
if not os.path.isfile(fpath):
|
if not os.path.isfile(fpath):
|
||||||
raise MissingConfigError(path)
|
raise MissingConfigError(fpath)
|
||||||
return json_ro(fpath)
|
return json_ro(fpath)
|
||||||
|
|
||||||
def edit(self, filename):
|
def edit(self, filename):
|
||||||
|
@ -49,7 +49,7 @@ class ConfigDirectoryContext():
|
||||||
filename = f'{filename}.json'
|
filename = f'{filename}.json'
|
||||||
fpath = os.path.join(self.path, filename)
|
fpath = os.path.join(self.path, filename)
|
||||||
if not os.path.isfile(fpath):
|
if not os.path.isfile(fpath):
|
||||||
raise MissingConfigError(path)
|
raise MissingConfigError(fpath)
|
||||||
return json_rw(fpath, new=False)
|
return json_rw(fpath, new=False)
|
||||||
|
|
||||||
def delete(self, filename):
|
def delete(self, filename):
|
||||||
|
@ -58,7 +58,7 @@ class ConfigDirectoryContext():
|
||||||
filename = f'{filename}.json'
|
filename = f'{filename}.json'
|
||||||
fpath = os.path.join(self.path, filename)
|
fpath = os.path.join(self.path, filename)
|
||||||
if not os.path.isfile(fpath):
|
if not os.path.isfile(fpath):
|
||||||
raise MissingConfigError(path)
|
raise MissingConfigError(fpath)
|
||||||
os.delete(fpath)
|
os.delete(fpath)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,13 +4,13 @@ class AmanuensisError(Exception):
|
||||||
class MissingConfigError(AmanuensisError):
|
class MissingConfigError(AmanuensisError):
|
||||||
"""A config file is missing that was expected to be present"""
|
"""A config file is missing that was expected to be present"""
|
||||||
def __init__(self, path):
|
def __init__(self, path):
|
||||||
super.__init__(self, "A config file or directory was expected to "
|
super().__init__(self, "A config file or directory was expected to "
|
||||||
f"exist, but could not be found: {path}")
|
f"exist, but could not be found: {path}")
|
||||||
|
|
||||||
class ConfigAlreadyExistsError(AmanuensisError):
|
class ConfigAlreadyExistsError(AmanuensisError):
|
||||||
"""Attempted to create a config, but it already exists"""
|
"""Attempted to create a config, but it already exists"""
|
||||||
def __init__(self, path):
|
def __init__(self, path):
|
||||||
super.__init__(self, "Attempted to create a config, but it already "
|
super().__init__(self, "Attempted to create a config, but it already "
|
||||||
f"exists: {path}")
|
f"exists: {path}")
|
||||||
|
|
||||||
class MalformedConfigError(AmanuensisError):
|
class MalformedConfigError(AmanuensisError):
|
||||||
|
|
Loading…
Reference in New Issue