From d779b485038d2027389ae9c907cbc143516cea61 Mon Sep 17 00:00:00 2001 From: tobes Date: Wed, 19 Jun 2013 10:19:43 +0100 Subject: [PATCH] [#1002] Better preview plugin selection --- ckan/controllers/package.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/ckan/controllers/package.py b/ckan/controllers/package.py index 3d6ea1fc2a8..30add28276c 100644 --- a/ckan/controllers/package.py +++ b/ckan/controllers/package.py @@ -1366,12 +1366,8 @@ def resource_datapreview(self, id, resource_id): # multiple plugins plugs = [pl['plugin'] for pl in plugins_that_can_preview] log.warn('Multiple previews are possible. {0}'.format(plugs)) - qual = max(plugins_that_can_preview, key=lambda x:x['quality']) - # we are just grabing one of the best quality here - preview_plugins = [pl['plugin'] for pl in - plugins_that_can_preview - if pl['quality'] == qual] - preview_plugin = preview_plugins[0] + preview_plugin = max(plugins_that_can_preview, + key=lambda x: x['quality']) preview_plugin.setup_template_variables(context, data_dict) c.resource_json = json.dumps(c.resource)