mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-06-03 10:50:20 +00:00
first_boot: Drop use of loaded_modules and use App.list
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
57422d562e
commit
bc3a879ead
@ -5,10 +5,12 @@ FreedomBox app for first boot wizard.
|
||||
|
||||
import operator
|
||||
import os
|
||||
import sys
|
||||
|
||||
from django.urls import reverse
|
||||
|
||||
from plinth import app, cfg, module_loader
|
||||
from plinth import app as app_module
|
||||
from plinth import cfg
|
||||
from plinth.signals import post_setup
|
||||
|
||||
first_boot_steps = [
|
||||
@ -30,7 +32,7 @@ _all_first_boot_steps = None
|
||||
_is_completed = None
|
||||
|
||||
|
||||
class FirstBootApp(app.App):
|
||||
class FirstBootApp(app_module.App):
|
||||
"""FreedomBox app for First Boot."""
|
||||
|
||||
app_id = 'first_boot'
|
||||
@ -41,8 +43,8 @@ class FirstBootApp(app.App):
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
info = app.Info(app_id=self.app_id, version=self._version,
|
||||
is_essential=True)
|
||||
info = app_module.Info(app_id=self.app_id, version=self._version,
|
||||
is_essential=True)
|
||||
self.add(info)
|
||||
|
||||
def post_init(self):
|
||||
@ -76,11 +78,11 @@ def _get_steps():
|
||||
return _all_first_boot_steps
|
||||
|
||||
steps = []
|
||||
modules = module_loader.loaded_modules
|
||||
for module_object in modules.values():
|
||||
if getattr(module_object, 'first_boot_steps', None):
|
||||
if not module_object.app.needs_setup():
|
||||
steps.extend(module_object.first_boot_steps)
|
||||
for app in app_module.App.list():
|
||||
module = sys.modules[app.__module__]
|
||||
if getattr(module, 'first_boot_steps', None):
|
||||
if not app.needs_setup():
|
||||
steps.extend(module.first_boot_steps)
|
||||
|
||||
_all_first_boot_steps = sorted(steps, key=operator.itemgetter('order'))
|
||||
return _all_first_boot_steps
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user