mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-24 02:04:04 +08:00
Merge pull request #8376 from guerler/fix_viz_routes
Identify visualization static path from absolute path
This commit is contained in:
@@ -72,8 +72,8 @@ class VisualizationPlugin(ServesTemplatesPluginMixin):
|
||||
self.config = config
|
||||
base_url = context.get('base_url', '')
|
||||
self.base_url = '/'.join([base_url, self.name]) if base_url else self.name
|
||||
self.static_path = os.path.join(self.path.replace('./config', './static'), 'static')
|
||||
if os.path.exists(os.path.join(self.static_path, 'logo.png')):
|
||||
self.static_path = self._get_static_path(self.path)
|
||||
if self.static_path and os.path.exists(os.path.join(self.static_path, 'logo.png')):
|
||||
self.config['logo'] = '/'.join([self.static_path, 'logo.png'])
|
||||
template_cache_dir = context.get('template_cache_dir', None)
|
||||
additional_template_paths = context.get('additional_template_paths', [])
|
||||
@@ -127,6 +127,13 @@ class VisualizationPlugin(ServesTemplatesPluginMixin):
|
||||
return url_for(controller='visualization', action=self.name)
|
||||
return url_for('visualization_plugin', visualization_name=self.name)
|
||||
|
||||
def _get_static_path(self, path):
|
||||
if '/config/' in path:
|
||||
match = path.split('/config/')[-1]
|
||||
return os.path.join('./static', match, 'static')
|
||||
else:
|
||||
log.debug('Visualization has no static path: %s.' % path)
|
||||
|
||||
def _get_saved_visualization_config(self, visualization, revision=None, **kwargs):
|
||||
"""
|
||||
Return the config of a saved visualization and revision.
|
||||
|
||||
@@ -189,6 +189,8 @@ class VisualizationsRegistry(object):
|
||||
if config is not None:
|
||||
plugin = self._build_plugin(plugin_name, plugin_path, config)
|
||||
return plugin
|
||||
else:
|
||||
raise ObjectNotFound('Visualization XML not found: %s.' % config_file)
|
||||
|
||||
def _build_plugin(self, plugin_name, plugin_path, config):
|
||||
# TODO: as builder not factory
|
||||
|
||||
Reference in New Issue
Block a user