Better handling of default extension exceptions
This commit is contained in:
parent
94aac61925
commit
bc5c410abc
2 changed files with 15 additions and 7 deletions
|
|
@ -1,4 +1,14 @@
|
|||
import logging
|
||||
import traceback
|
||||
|
||||
from .autofocus import autofocus_extension_v2
|
||||
from .scan import scan_extension_v2
|
||||
from .zip_builder import zip_extension_v2
|
||||
from .picamera_autocalibrate import lst_extension_v2
|
||||
|
||||
# "Gracefully" handle cases where picamera cannot be imported (eg test server)
|
||||
try:
|
||||
from .picamera_autocalibrate import lst_extension_v2
|
||||
except Exception as e:
|
||||
logging.error(
|
||||
f"Exception loading builtin extension picamera_autocalibrate: \n{traceback.format_exc()}"
|
||||
)
|
||||
|
|
@ -36,7 +36,7 @@ class BaseExtension:
|
|||
self.actions = []
|
||||
self.properties = []
|
||||
|
||||
self.name = name
|
||||
self._name = name
|
||||
self.description = get_docstring(self)
|
||||
self.version = str(version)
|
||||
|
||||
|
|
@ -57,9 +57,6 @@ class BaseExtension:
|
|||
|
||||
view_id = cleaned_rule.replace("/", "_").replace("<", "").replace(">", "")
|
||||
|
||||
# Create a Python-safe route ID
|
||||
logging.debug(view_id)
|
||||
|
||||
# Store route information in a dictionary
|
||||
d = {"rule": full_rule, "view": view_class, "kwargs": kwargs}
|
||||
|
||||
|
|
@ -82,8 +79,8 @@ class BaseExtension:
|
|||
self._meta[key] = val
|
||||
|
||||
@property
|
||||
def _name(self):
|
||||
return self.name
|
||||
def name(self):
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def _name_python_safe(self):
|
||||
|
|
@ -111,6 +108,7 @@ def find_instances_in_module(module, class_to_find):
|
|||
for attribute in dir(module):
|
||||
if not attribute.startswith("__"):
|
||||
if isinstance(getattr(module, attribute), class_to_find):
|
||||
logging.debug(f"Found extension {getattr(module, attribute).name}")
|
||||
objs.append(getattr(module, attribute))
|
||||
return objs
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue