mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-13 14:44:29 -04:00
temporarily add prints on plugin setup for easier debugging
This commit is contained in:
parent
a9a97c013d
commit
77d3990535
2 changed files with 10 additions and 0 deletions
|
@ -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."
|
# 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
|
# record installed hook in settings.HOOKS
|
||||||
settings.HOOKS[self.id] = self
|
settings.HOOKS[self.id] = self
|
||||||
|
|
||||||
|
@ -116,6 +118,8 @@ class BaseHook(BaseModel):
|
||||||
def ready(self, settings):
|
def ready(self, settings):
|
||||||
"""Runs any runtime code needed when AppConfig.ready() is called (after all models are imported)."""
|
"""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."
|
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:
|
if settings.HOOKS[self.id]._is_ready:
|
||||||
|
|
|
@ -130,6 +130,9 @@ class BasePlugin(BaseModel):
|
||||||
if settings is None:
|
if settings is None:
|
||||||
from django.conf import settings as django_settings
|
from django.conf import settings as django_settings
|
||||||
settings = 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.'
|
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
|
from django.conf import settings as django_settings
|
||||||
settings = django_settings
|
settings = django_settings
|
||||||
|
|
||||||
|
print()
|
||||||
|
print(self.plugin_module_full, '.ready()')
|
||||||
|
|
||||||
assert (
|
assert (
|
||||||
self.id in settings.PLUGINS and settings.PLUGINS[self.id]._is_registered
|
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."
|
), f"Tried to run plugin.ready() for {self.plugin_module} but plugin is not yet registered in settings.PLUGINS."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue