Warning
This document is for an old release of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.
galaxy.web.framework package¶
Galaxy web application framework
Subpackages¶
- galaxy.web.framework.helpers package
- galaxy.web.framework.middleware package
- Submodules
- galaxy.web.framework.middleware.batch module
- galaxy.web.framework.middleware.error module
- galaxy.web.framework.middleware.graphite module
- galaxy.web.framework.middleware.profile module
- galaxy.web.framework.middleware.remoteuser module
- galaxy.web.framework.middleware.request_id module
- galaxy.web.framework.middleware.sentry module
- galaxy.web.framework.middleware.static module
- galaxy.web.framework.middleware.statsd module
- galaxy.web.framework.middleware.translogger module
- galaxy.web.framework.middleware.xforwardedhost module
Submodules¶
galaxy.web.framework.base module¶
A simple WSGI application/framework.
-
galaxy.web.framework.base.
server_starttime
= 1603085335¶ time of the most recent server startup
-
class
galaxy.web.framework.base.
WebApplication
[source]¶ Bases:
object
A simple web application which maps requests to objects using routes, and to methods on those objects in the CherryPy style. Thus simple argument mapping in the CherryPy style occurs automatically, but more complicated encoding of arguments in the PATH_INFO can be performed with routes.
-
__init__
()[source]¶ Create a new web application object. To actually connect some controllers use add_controller and add_route. Call finalize_config when all controllers and routes have been added and __call__ to handle a request (WSGI style).
-
add_ui_controller
(controller_name, controller)[source]¶ Add a controller class to this application. A controller class has methods which handle web requests. To connect a URL to a controller’s method use add_route.
-
add_route
(route, **kwargs)[source]¶ Add a route to match a URL with a method. Accepts all keyword arguments of routes.Mapper.connect. Every route should result in at least a controller value which corresponds to one of the objects added with add_controller. It optionally may yield an action argument which will be used to locate the method to call on the controller. Additional arguments will be passed to the method as keyword args.
-
set_transaction_factory
(transaction_factory)[source]¶ Use the callable transaction_factory to create the transaction which will be passed to requests.
-
-
class
galaxy.web.framework.base.
WSGIEnvironmentProperty
(key, default='')[source]¶ Bases:
object
Descriptor that delegates a property to a key in the environ member of the associated object (provides property style access to keys in the WSGI environment)
-
class
galaxy.web.framework.base.
LazyProperty
(func)[source]¶ Bases:
object
Property that replaces itself with a calculated value the first time it is used.
-
galaxy.web.framework.base.
lazy_property
¶
-
class
galaxy.web.framework.base.
DefaultWebTransaction
(environ)[source]¶ Bases:
object
Wraps the state of a single web transaction (request/response cycle).
- TODO: Provide hooks to allow application specific state to be included
- in here.
-
class
galaxy.web.framework.base.
FieldStorage
(fp=None, headers=None, outerboundary='', environ={'JENKINS_HOME': '/var/lib/jenkins', 'BUILD_CAUSE': 'UPSTREAMTRIGGER', 'JOB_BASE_NAME': 'PYTHON=System-CPython-2.7, TARGET_GIT_BRANCH=release_18.05', 'PYTHON': 'System-CPython-2.7', 'HUDSON_URL': 'https://jenkins.galaxyproject.org/', 'BUILD_URL': 'https://jenkins.galaxyproject.org/job/galaxy-sphinx-by-branch/PYTHON=System-CPython-2.7, TARGET_GIT_BRANCH=release_18.05/3485/', 'GIT_PREVIOUS_COMMIT': '6ac956b57c753caef7f28ed3dbfdbd498f0858fe', 'BUILD_TAG': 'jenkins-galaxy-sphinx-by-branch-PYTHON=System-CPython-2.7, TARGET_GIT_BRANCH=release_18.05-3485', 'XDG_SESSION_TYPE': 'tty', 'HUDSON_SERVER_COOKIE': 'f442d5996560f01b', 'JENKINS_URL': 'https://jenkins.galaxyproject.org/', 'LOGNAME': 'jenkins', 'USER': 'jenkins', 'WORKSPACE': '/var/jenkins/workspace/galaxy-sphinx-by-branch/PYTHON/System-CPython-2.7/TARGET_GIT_BRANCH/release_18.05', 'PATH': '/var/jenkins/workspace/galaxy-sphinx-by-branch/PYTHON/System-CPython-2.7/TARGET_GIT_BRANCH/release_18.05/.venv/bin:/var/jenkins/workspace/galaxy-sphinx-by-branch/PYTHON/System-CPython-2.7/TARGET_GIT_BRANCH/release_18.05/.venv/bin:/usr/local/bin:/usr/bin:/bin:/usr/games', 'HOME': '/home/jenkins', 'PS1': '(.venv)(.venv)$ ', 'JOB_NAME': 'galaxy-sphinx-by-branch/PYTHON=System-CPython-2.7, TARGET_GIT_BRANCH=release_18.05', 'MAKEFLAGS': 'w', 'LANG': 'en_US.UTF-8', 'RUN_DISPLAY_URL': 'https://jenkins.galaxyproject.org/job/galaxy-sphinx-by-branch/PYTHON=System-CPython-2.7, TARGET_GIT_BRANCH=release_18.05/3485/display/redirect', 'VIRTUAL_ENV': '/var/jenkins/workspace/galaxy-sphinx-by-branch/PYTHON/System-CPython-2.7/TARGET_GIT_BRANCH/release_18.05/.venv', 'SHELL': '/bin/sh', 'GIT_PREVIOUS_SUCCESSFUL_COMMIT': '6ac956b57c753caef7f28ed3dbfdbd498f0858fe', 'HUDSON_HOME': '/var/lib/jenkins', 'NODE_LABELS': 'doc_builder n9.galaxyproject.org psu_node', 'MFLAGS': '-w', 'ROOT_BUILD_CAUSE': 'TIMERTRIGGER', 'XDG_SESSION_CLASS': 'user', 'BUILD_ID': '3485', 'BUILD_NUMBER': '3485', 'XDG_RUNTIME_DIR': '/run/user/1000', 'HUDSON_COOKIE': 'b5d4a1b1-5eb2-41ab-a199-3d842ea793f9', 'JOB_URL': 'https://jenkins.galaxyproject.org/job/galaxy-sphinx-by-branch/PYTHON=System-CPython-2.7, TARGET_GIT_BRANCH=release_18.05/', 'GIT_URL': 'https://github.com/galaxyproject/galaxy/', 'GIT_COMMIT': '6ac956b57c753caef7f28ed3dbfdbd498f0858fe', 'RUN_CHANGES_DISPLAY_URL': 'https://jenkins.galaxyproject.org/job/galaxy-sphinx-by-branch/PYTHON=System-CPython-2.7, TARGET_GIT_BRANCH=release_18.05/3485/display/redirect?page=changes', 'ROOT_BUILD_CAUSE_TIMERTRIGGER': 'true', 'XDG_SESSION_ID': '7', 'AWS_ACCESS_KEY_ID': 'AKIAYX7HSEMC7DKPIMU7', 'BUILD_CAUSE_UPSTREAMTRIGGER': 'true', 'JOB_DISPLAY_URL': 'https://jenkins.galaxyproject.org/job/galaxy-sphinx-by-branch/PYTHON=System-CPython-2.7, TARGET_GIT_BRANCH=release_18.05/display/redirect', 'WORKSPACE_TMP': '/var/jenkins/workspace/galaxy-sphinx-by-branch/PYTHON/System-CPython-2.7/TARGET_GIT_BRANCH/release_18.05@tmp', 'SSH_CLIENT': '172.18.2.43 48656 22', 'EXECUTOR_NUMBER': '1', 'NODE_NAME': 'n9.galaxyproject.org', 'MAKELEVEL': '2', 'PWD': '/var/jenkins/workspace/galaxy-sphinx-by-branch/PYTHON/System-CPython-2.7/TARGET_GIT_BRANCH/release_18.05', 'JENKINS_SERVER_COOKIE': 'f442d5996560f01b', 'BUILD_DISPLAY_NAME': '#3485', 'AWS_SECRET_ACCESS_KEY': 'L+6N5EfuLyZB/84Hv0vAun6h9DXcn0pLcePGuSV9', 'MAIL': '/var/mail/jenkins', 'SSH_CONNECTION': '172.18.2.43 48656 172.18.2.49 22', 'TARGET_GIT_BRANCH': 'release_18.05', 'GIT_BRANCH': 'origin/dev'}, keep_blank_values=0, strict_parsing=0, max_num_fields=None)[source]¶ Bases:
cgi.FieldStorage
-
class
galaxy.web.framework.base.
Request
(environ)[source]¶ Bases:
webob.request.Request
Encapsulates an HTTP request.
-
remote_host
[source]¶ Property that replaces itself with a calculated value the first time it is used.
-
remote_hostname
[source]¶ Property that replaces itself with a calculated value the first time it is used.
Property that replaces itself with a calculated value the first time it is used.
-
browser_url
[source]¶ Property that replaces itself with a calculated value the first time it is used.
-
remote_port
¶ Descriptor that delegates a property to a key in the environ member of the associated object (provides property style access to keys in the WSGI environment)
-
protocol
¶ Descriptor that delegates a property to a key in the environ member of the associated object (provides property style access to keys in the WSGI environment)
-
galaxy.web.framework.decorators module¶
-
galaxy.web.framework.decorators.
expose
(func)[source]¶ Decorator: mark a function as ‘exposed’ and thus web accessible
-
galaxy.web.framework.decorators.
json
(func, pretty=False)[source]¶ Format the response as JSON and set the response content type to JSON_CONTENT_TYPE.
-
galaxy.web.framework.decorators.
require_login
(verb='perform this action', use_panels=False, webapp='galaxy')[source]¶
-
galaxy.web.framework.decorators.
expose_api
(func, to_json=True, user_required=True)[source]¶ Expose this function via the API.
-
galaxy.web.framework.decorators.
expose_api_raw
(func)[source]¶ Expose this function via the API but don’t dump the results to JSON.
galaxy.web.framework.formbuilder module¶
galaxy.web.framework.openid_manager module¶
Manage the OpenID consumer and related data stores.
galaxy.web.framework.webapp module¶
-
class
galaxy.web.framework.webapp.
WebApplication
(galaxy_app, session_cookie='galaxysession', name=None)[source]¶ Bases:
galaxy.web.framework.base.WebApplication
Base WSGI application instantiated for all Galaxy webapps.
- A web application that:
- adds API and UI controllers by scanning given directories and
importing all modules found there. * has a security object. * builds mako template lookups. * generates GalaxyWebTransactions.
-
class
galaxy.web.framework.webapp.
GalaxyWebTransaction
(environ, app, webapp, session_cookie=None)[source]¶ Bases:
galaxy.web.framework.base.DefaultWebTransaction
,galaxy.managers.context.ProvidesAppContext
,galaxy.managers.context.ProvidesUserContext
,galaxy.managers.context.ProvidesHistoryContext
Encapsulates web transaction specific state for the Galaxy application (specifically the user’s “cookie” session and history)
-
set_cors_headers
()[source]¶ Allow CORS requests if configured to do so by echoing back the request’s ‘Origin’ header (if any) as the response header ‘Access-Control-Allow-Origin’
-
user
¶ Return the current user if logged in or None.
Convenience method for getting a session cookie
Convenience method for setting a session cookie
-
get_or_create_remote_user
(remote_user_email)[source]¶ Create a remote user with the email remote_user_email and return it
-
handle_user_login
(user)[source]¶ - Login a new user (possibly newly created)
- do some ‘system’ checks (if any) for this user
- create a new session
- associate new session with user
- if old session had a history and it was not associated with a user, associate it with the new session, otherwise associate the current session’s history with the user
- add the disk usage of the current session to the user’s total disk usage
-
handle_user_logout
(logout_all=False)[source]¶ - Logout the current user:
- invalidate the current session
- create a new session with no user associated
-
get_history
(create=False, most_recent=False)[source]¶ - Load the current history.
- If that isn’t available, we find the most recently updated history.
- If that isn’t available, we get or create the default history.
Transactions will not always have an active history (API requests), so None is a valid response.
-
history
¶ - Load the current history.
- If that isn’t available, we find the most recently updated history.
- If that isn’t available, we get or create the default history.
Transactions will not always have an active history (API requests), so None is a valid response.
-
get_or_create_default_history
()[source]¶ Gets or creates a default history and associates it with the current session.
-
new_history
(name=None)[source]¶ Create a new history and associate it with the current session and its associated user (if set).
-
template_context
¶ Property that replaces itself with a calculated value the first time it is used.
-
set_message
(message, type=None)[source]¶ Convenience method for setting the ‘message’ and ‘message_type’ element of the template context.
-
get_message
()[source]¶ Convenience method for getting the ‘message’ element of the template context.
-
show_message
(message, type='info', refresh_frames=[], cont=None, use_panels=False, active_view='')[source]¶ Convenience method for displaying a simple page with a single message.
- type: one of “error”, “warning”, “info”, or “done”; determines the
- type of dialog box and icon displayed with the message
- refresh_frames: names of frames in the interface that should be
- refreshed when the message is displayed
-
show_error_message
(message, refresh_frames=[], use_panels=False, active_view='')[source]¶ Convenience method for displaying an error message. See show_message.
-
show_ok_message
(message, refresh_frames=[], use_panels=False, active_view='')[source]¶ Convenience method for displaying an ok message. See show_message.
-
show_warn_message
(message, refresh_frames=[], use_panels=False, active_view='')[source]¶ Convenience method for displaying an warn message. See show_message.
-
session_csrf_token
¶
-