raise InvalidSpec if no colon
This commit is contained in:
parent
64ae8e9136
commit
f6bb5b2b77
2 changed files with 9 additions and 0 deletions
|
@ -73,6 +73,12 @@ class LoadSpecError(Exception):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
class InvalidSpec(LoadSpecError):
|
||||||
|
|
||||||
|
def specifics(self):
|
||||||
|
return "invalid spec"
|
||||||
|
|
||||||
|
|
||||||
class ModuleMissingAttribute(LoadSpecError):
|
class ModuleMissingAttribute(LoadSpecError):
|
||||||
"""
|
"""
|
||||||
Raised during :func:`edbob.load_spec()` when the module imported okay but
|
Raised during :func:`edbob.load_spec()` when the module imported okay but
|
||||||
|
|
|
@ -82,6 +82,9 @@ def load_spec(spec):
|
||||||
necessary.
|
necessary.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if spec.count(':') != 1:
|
||||||
|
raise exceptions.InvalidSpec(spec)
|
||||||
|
|
||||||
module_path, obj = spec.split(':')
|
module_path, obj = spec.split(':')
|
||||||
module = import_module_path(module_path)
|
module = import_module_path(module_path)
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue