Skip to content

Commit

Permalink
[#1002] Better preview plugin selection
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed Jun 19, 2013
1 parent 9098fb9 commit d779b48
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions ckan/controllers/package.py
Expand Up @@ -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)
Expand Down

0 comments on commit d779b48

Please sign in to comment.