mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-16 07:19:13 +08:00
Interactive environments: move static base url from 'visualizations' to 'interactive_environments' for int env plugins
This commit is contained in:
@@ -436,7 +436,7 @@ class Configuration( object ):
|
||||
self.fluent_log = string_as_bool( kwargs.get( 'fluent_log', False ) )
|
||||
self.fluent_host = kwargs.get( 'fluent_host', 'localhost' )
|
||||
self.fluent_port = int( kwargs.get( 'fluent_port', 24224 ) )
|
||||
# directory where the visualization/registry searches for plugins
|
||||
# directory where the visualization registry searches for plugins
|
||||
self.visualization_plugins_directory = kwargs.get(
|
||||
'visualization_plugins_directory', 'config/plugins/visualizations' )
|
||||
ie_dirs = kwargs.get( 'interactive_environment_plugins_directory', None )
|
||||
|
||||
@@ -119,7 +119,6 @@ class VisualizationPlugin( pluginframework.Plugin, ServesStaticPluginMixin, Serv
|
||||
|
||||
base_url = context.get( 'base_url', '' )
|
||||
self.base_url = '/'.join([ base_url, self.name ]) if base_url else self.name
|
||||
|
||||
self._set_up_static_plugin()
|
||||
|
||||
template_cache_dir = context.get( 'template_cache_dir', None )
|
||||
@@ -252,6 +251,11 @@ class InteractiveEnvironmentPlugin( VisualizationPlugin ):
|
||||
"""
|
||||
INTENV_REQUEST_FACTORY = interactive_environments.InteractiveEnviornmentRequest
|
||||
|
||||
def __init__( self, app, path, name, config, context=None, **kwargs ):
|
||||
# TODO: this is a hack until we can get int envs seperated from the vis reg and into their own framework
|
||||
context[ 'base_url' ] = 'interactive_environments'
|
||||
super( InteractiveEnvironmentPlugin, self ).__init__( app, path, name, config, context=context, **kwargs )
|
||||
|
||||
def _render( self, render_vars, trans=None, embedded=None, **kwargs ):
|
||||
"""
|
||||
Override to add interactive environment specific template vars.
|
||||
|
||||
@@ -31,6 +31,7 @@ class VisualizationsRegistry( pluginframework.PageServingPluginManager ):
|
||||
- validating and parsing params into resources (based on a context)
|
||||
used in the visualization template
|
||||
"""
|
||||
DEFAULT_BASE_URL = 'visualizations'
|
||||
# these should be handled somewhat differently - and be passed onto their resp. methods in ctrl.visualization
|
||||
# TODO: change/remove if/when they can be updated to use this system
|
||||
#: any built in visualizations that have their own render method in ctrls/visualization
|
||||
@@ -47,8 +48,7 @@ class VisualizationsRegistry( pluginframework.PageServingPluginManager ):
|
||||
def __init__( self, app, skip_bad_plugins=True, **kwargs ):
|
||||
self.app = weakref.ref( app )
|
||||
self.config_parser = config_parser.VisualizationsConfigParser()
|
||||
super( VisualizationsRegistry, self ).__init__( app, 'visualizations',
|
||||
skip_bad_plugins=skip_bad_plugins, **kwargs )
|
||||
super( VisualizationsRegistry, self ).__init__( app, skip_bad_plugins=skip_bad_plugins, **kwargs )
|
||||
|
||||
def is_plugin( self, plugin_path ):
|
||||
"""
|
||||
|
||||
@@ -364,6 +364,8 @@ class PageServingPluginManager( PluginManager ):
|
||||
"""
|
||||
# TODO: I'm unclear of the utility of this class - it prob. will only have one subclass (vis reg). Fold into?
|
||||
|
||||
#: default static url base
|
||||
DEFAULT_BASE_URL = ''
|
||||
#: does the class need static files served?
|
||||
serves_static = True
|
||||
#: does the class need template files served?
|
||||
@@ -375,7 +377,7 @@ class PageServingPluginManager( PluginManager ):
|
||||
#: name of files to search for additional template lookup directories
|
||||
additional_template_paths_config_filename = 'additional_template_paths.xml'
|
||||
|
||||
def __init__( self, app, base_url, template_cache_dir=None, **kwargs ):
|
||||
def __init__( self, app, base_url='', template_cache_dir=None, **kwargs ):
|
||||
"""
|
||||
Set up the manager and load all plugins.
|
||||
|
||||
@@ -387,7 +389,9 @@ class PageServingPluginManager( PluginManager ):
|
||||
:param template_cache_dir: filesytem path to the directory where cached
|
||||
templates are kept
|
||||
"""
|
||||
self.base_url = base_url
|
||||
self.base_url = base_url or self.DEFAULT_BASE_URL
|
||||
if not self.base_url:
|
||||
raise PluginManagerException( 'base_url or DEFAULT_BASE_URL required' )
|
||||
self.template_cache_dir = template_cache_dir
|
||||
self.additional_template_paths = []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user