raise InvalidSpec if no colon

This commit is contained in:
Lance Edgar 2012-11-27 14:33:23 -08:00
parent 64ae8e9136
commit f6bb5b2b77
2 changed files with 9 additions and 0 deletions

View file

@ -73,6 +73,12 @@ class LoadSpecError(Exception):
return None
class InvalidSpec(LoadSpecError):
def specifics(self):
return "invalid spec"
class ModuleMissingAttribute(LoadSpecError):
"""
Raised during :func:`edbob.load_spec()` when the module imported okay but

View file

@ -82,6 +82,9 @@ def load_spec(spec):
necessary.
"""
if spec.count(':') != 1:
raise exceptions.InvalidSpec(spec)
module_path, obj = spec.split(':')
module = import_module_path(module_path)
try: