mirror of
https://github.com/pirate/ArchiveBox.git
synced 2025-08-11 17:14:38 +02:00
temporarily add prints on plugin setup for easier debugging
This commit is contained in:
@@ -103,6 +103,8 @@ class BaseHook(BaseModel):
|
||||
|
||||
# assert json.dumps(self.model_json_schema(), indent=4), f"Hook {self.hook_module} has invalid JSON schema."
|
||||
|
||||
print(' -', self.hook_module, '.register()')
|
||||
|
||||
# record installed hook in settings.HOOKS
|
||||
settings.HOOKS[self.id] = self
|
||||
|
||||
@@ -116,6 +118,8 @@ class BaseHook(BaseModel):
|
||||
def ready(self, settings):
|
||||
"""Runs any runtime code needed when AppConfig.ready() is called (after all models are imported)."""
|
||||
|
||||
print(' -', self.hook_module, '.ready()')
|
||||
|
||||
assert self.id in settings.HOOKS, f"Tried to ready hook {self.hook_module} but it is not registered in settings.HOOKS."
|
||||
|
||||
if settings.HOOKS[self.id]._is_ready:
|
||||
|
@@ -130,6 +130,9 @@ class BasePlugin(BaseModel):
|
||||
if settings is None:
|
||||
from django.conf import settings as django_settings
|
||||
settings = django_settings
|
||||
|
||||
print()
|
||||
print(self.plugin_module_full, '.register()')
|
||||
|
||||
assert json.dumps(self.model_json_schema(), indent=4), f'Plugin {self.plugin_module} has invalid JSON schema.'
|
||||
|
||||
@@ -154,6 +157,9 @@ class BasePlugin(BaseModel):
|
||||
from django.conf import settings as django_settings
|
||||
settings = django_settings
|
||||
|
||||
print()
|
||||
print(self.plugin_module_full, '.ready()')
|
||||
|
||||
assert (
|
||||
self.id in settings.PLUGINS and settings.PLUGINS[self.id]._is_registered
|
||||
), f"Tried to run plugin.ready() for {self.plugin_module} but plugin is not yet registered in settings.PLUGINS."
|
||||
|
Reference in New Issue
Block a user