Skip to content

Commit

Permalink
Merge branch 'master' into 4870-enable-ods-views
Browse files Browse the repository at this point in the history
  • Loading branch information
Nehimyeah committed Aug 22, 2019
2 parents 2a75675 + 3160346 commit d9bb9b1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
8 changes: 4 additions & 4 deletions ckan/plugins/core.py
Expand Up @@ -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
Expand Down
13 changes: 9 additions & 4 deletions ckan/tests/legacy/test_plugins.py
Expand Up @@ -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()
Expand Down Expand Up @@ -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, {})
Expand Down
2 changes: 1 addition & 1 deletion requirements.in
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Expand Up @@ -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
Expand Down

0 comments on commit d9bb9b1

Please sign in to comment.