diff --git a/plinth/app.py b/plinth/app.py index a67126002..6e6e36981 100644 --- a/plinth/app.py +++ b/plinth/app.py @@ -46,7 +46,7 @@ class App: del self.components[component_id] return component - def get(self, component_id): + def get_component(self, component_id): """Return a component given the component's ID.""" return self.components[component_id] diff --git a/plinth/modules/mediawiki/views.py b/plinth/modules/mediawiki/views.py index 491e6143b..9a927dd54 100644 --- a/plinth/modules/mediawiki/views.py +++ b/plinth/modules/mediawiki/views.py @@ -111,7 +111,7 @@ class MediaWikiServiceView(views.ServiceView): actions.superuser_run('mediawiki', ['private-mode', 'disable']) messages.success(self.request, _('Private mode disabled')) - mediawiki.app.get('shortcut-mediawiki').login_required = \ - new_config['enable_private_mode'] + shortcut = mediawiki.app.get_component('shortcut-mediawiki') + shortcut.login_required = new_config['enable_private_mode'] return super().form_valid(form) diff --git a/plinth/tests/test_app.py b/plinth/tests/test_app.py index 8a9bfd50e..946bf7081 100644 --- a/plinth/tests/test_app.py +++ b/plinth/tests/test_app.py @@ -66,13 +66,13 @@ def test_app_remove(app_with_components): assert 'test-leader-1' not in app.components -def test_get(app_with_components): +def test_get_component(app_with_components): """Test retrieving a component from an App.""" app = app_with_components component = app.components['test-leader-1'] - assert app.get('test-leader-1') == component + assert app.get_component('test-leader-1') == component with pytest.raises(KeyError): - app.get('x-invalid-component') + app.get_component('x-invalid-component') def test_app_enable(app_with_components):