diff --git a/ckan/plugins/core.py b/ckan/plugins/core.py index 14098016d0d..9a95a42590e 100644 --- a/ckan/plugins/core.py +++ b/ckan/plugins/core.py @@ -112,10 +112,10 @@ def plugins_update(): # the file containing them is imported, for example if two or more # extensions are defined in the same file. Therefore we do a sanity # check and disable any that should not be active. - for env in PluginGlobals.env_registry.values(): - for service in env.services.copy(): - if service.__class__ not in _PLUGINS_CLASS: - service.deactivate() + for env in PluginGlobals.env.values(): + for service, id_ in env.singleton_services.items(): + if service not in _PLUGINS_CLASS: + PluginGlobals.plugin_instances[id_].deactivate() # Reset CKAN to reflect the currently enabled extensions. import ckan.config.environment as environment diff --git a/ckan/tests/legacy/test_plugins.py b/ckan/tests/legacy/test_plugins.py index 3af1524ad4b..7ec6bd59e71 100644 --- a/ckan/tests/legacy/test_plugins.py +++ b/ckan/tests/legacy/test_plugins.py @@ -101,7 +101,7 @@ def test_plugins_load(self): # synchronous_search automatically gets loaded current_plugins = set([plugins.get_plugin(p) for p in ['mapper_plugin', 'routes_plugin', 'synchronous_search'] + find_system_plugins()]) - assert PluginGlobals.env().services == current_plugins + assert set(plugins.core._PLUGINS_SERVICE.values()) == current_plugins # cleanup config['ckan.plugins'] = config_plugins plugins.load_all() @@ -175,10 +175,15 @@ def test_mapper_plugin_fired_on_delete(self): def test_routes_plugin_fired(self): with plugins.use_plugin('routes_plugin'): - routes_plugin = PluginGlobals.env_registry['pca'].plugin_registry['RoutesPlugin'].__instance__ - assert routes_plugin.calls_made == ['before_map', 'after_map'], \ - routes_plugin.calls_made + pca = PluginGlobals.env['pca'] + routes_plugin_idx = pca.singleton_services[ + pca.plugin_registry['RoutesPlugin'] + ] + + routes_plugin = PluginGlobals.plugin_instances[routes_plugin_idx] + assert routes_plugin.calls_made == ['before_map', 'after_map'], \ + routes_plugin.calls_made def test_action_plugin_override(self): status_show_original = logic.get_action('status_show')(None, {}) diff --git a/requirements.in b/requirements.in index e2c65c86874..af12c768660 100644 --- a/requirements.in +++ b/requirements.in @@ -19,7 +19,7 @@ pysolr==3.6.0 Pylons==0.9.7 python-dateutil>=1.5.0 pytz==2016.7 -pyutilib.component.core==4.6.4 +PyUtilib==5.7.1 pyyaml # needed by webassets. latest should be fine. repoze.who-friendlyform==1.0.8 repoze.who==2.3 diff --git a/requirements.txt b/requirements.txt index d563473965d..decccf4b28b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -38,7 +38,7 @@ python-dateutil==2.8.0 python-editor==1.0.4 # via alembic python-magic==0.4.15 pytz==2016.7 -pyutilib.component.core==4.6.4 +PyUtilib==5.7.1 pyyaml==5.1 redis==3.2.1 # via rq repoze.lru==0.7 # via routes