Warning

This document is for an in-development version 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 package

The Galaxy web application framework

galaxy.web.do_not_cache(func)[source]

Sets cache-prevention headers for the request.

galaxy.web.error(message)[source]
galaxy.web.expose(func)[source]

Decorator: mark a function as ‘exposed’ and thus web accessible

galaxy.web.expose_api(func, to_json=True, user_required=True, user_or_session_required=True, handle_jsonp=True)[source]

Expose this function via the API.

galaxy.web.expose_api_anonymous(func, to_json=True)[source]

Expose this function via the API but don’t require a set user.

galaxy.web.expose_api_anonymous_and_sessionless(func, to_json=True)[source]

Expose this function via the API but don’t require a user or a galaxy_session.

galaxy.web.expose_api_raw(func)[source]
galaxy.web.expose_api_raw_anonymous(func)[source]
galaxy.web.expose_api_raw_anonymous_and_sessionless(func)[source]
galaxy.web.format_return_as_json(rval, jsonp_callback=None, pretty=False)[source]

Formats a return value as JSON or JSONP if jsonp_callback is present.

Use pretty=True to return pretty printed json.

galaxy.web.json(func, pretty=False)[source]

Format the response as JSON and set the response content type to JSON_CONTENT_TYPE.

galaxy.web.json_pretty(func)[source]

Indent and sort returned JSON.

galaxy.web.legacy_expose_api(func, to_json=True, user_required=True)[source]

Expose this function via the API.

galaxy.web.legacy_expose_api_anonymous(func, to_json=True)[source]

Expose this function via the API but don’t require a set user.

galaxy.web.legacy_expose_api_raw(func)[source]

Expose this function via the API but don’t dump the results to JSON.

galaxy.web.legacy_expose_api_raw_anonymous(func)[source]

Expose this function via the API but don’t dump the results to JSON.

galaxy.web.require_admin(func)[source]
galaxy.web.require_login(verb='perform this action', use_panels=False, webapp='galaxy')[source]
galaxy.web.url_for(*args, **kargs)[source]

Generates a URL

All keys given to url_for are sent to the Routes Mapper instance for generation except for:

anchor          specified the anchor name to be appened to the path
host            overrides the default (current) host if provided
protocol        overrides the default (current) protocol if provided
qualified       creates the URL with the host/port information as
                needed

The URL is generated based on the rest of the keys. When generating a new URL, values will be used from the current request’s parameters (if present). The following rules are used to determine when and how to keep the current requests parameters:

  • If the controller is present and begins with ‘/’, no defaults are used
  • If the controller is changed, action is set to ‘index’ unless otherwise specified

For example, if the current request yielded a dict of {‘controller’: ‘blog’, ‘action’: ‘view’, ‘id’: 2}, with the standard ‘:controller/:action/:id’ route, you’d get the following results:

url_for(id=4)                    =>  '/blog/view/4',
url_for(controller='/admin')     =>  '/admin',
url_for(controller='admin')      =>  '/admin/view/2'
url_for(action='edit')           =>  '/blog/edit/2',
url_for(action='list', id=None)  =>  '/blog/list'

Static and Named Routes

If there is a string present as the first argument, a lookup is done against the named routes table to see if there’s any matching routes. The keyword defaults used with static routes will be sent in as GET query arg’s if a route matches.

If no route by that name is found, the string is assumed to be a raw URL. Should the raw URL begin with / then appropriate SCRIPT_NAME data will be added if present, otherwise the string will be used as the url with keyword args becoming GET query args.

Submodules

galaxy.web.buildapp module

For backward compatibility only, pulls app_factor from galaxy.webapps.main

galaxy.web.buildapp.app_factory(global_conf, load_app_kwds={}, **kwargs)[source]

Return a wsgi application serving the root object

galaxy.web.form_builder module

class galaxy.web.form_builder.AddressField(name, user=None, value=None, security=None, **kwds)[source]

Bases: galaxy.util.form_builder.BaseField

static fields()[source]
__init__(name, user=None, value=None, security=None, **kwds)[source]
to_dict()[source]
class galaxy.web.form_builder.BaseField(name, value=None, label=None, **kwds)[source]

Bases: object

__init__(name, value=None, label=None, **kwds)[source]
to_dict()[source]
class galaxy.web.form_builder.CheckboxField(name, value=None, label=None, **kwds)[source]

Bases: galaxy.util.form_builder.BaseField

A checkbox (boolean input)

static is_checked(value)[source]
to_dict()[source]
class galaxy.web.form_builder.HistoryField(name, user=None, value=None, security=None, **kwds)[source]

Bases: galaxy.util.form_builder.BaseField

__init__(name, user=None, value=None, security=None, **kwds)[source]
to_dict()[source]
class galaxy.web.form_builder.PasswordField(name, value=None, label=None, **kwds)[source]

Bases: galaxy.util.form_builder.BaseField

A password input box. text appears as “**

to_dict()[source]
class galaxy.web.form_builder.SelectField(name, multiple=None, display=None, field_id=None, value=None, selectlist=None, refresh_on_change=False, **kwds)[source]

Bases: galaxy.util.form_builder.BaseField

A select field.

__init__(name, multiple=None, display=None, field_id=None, value=None, selectlist=None, refresh_on_change=False, **kwds)[source]
add_option(text, value, selected=False)[source]
to_dict()[source]
class galaxy.web.form_builder.TextArea(name, value=None, label=None, **kwds)[source]

Bases: galaxy.util.form_builder.BaseField

A standard text area box.

to_dict()[source]
class galaxy.web.form_builder.TextField(name, value=None, label=None, **kwds)[source]

Bases: galaxy.util.form_builder.BaseField

A standard text input box.

to_dict()[source]
class galaxy.web.form_builder.WorkflowField(name, user=None, value=None, security=None, **kwds)[source]

Bases: galaxy.util.form_builder.BaseField

__init__(name, user=None, value=None, security=None, **kwds)[source]
to_dict()[source]
class galaxy.web.form_builder.WorkflowMappingField(name, user=None, value=None, **kwds)[source]

Bases: galaxy.util.form_builder.BaseField

__init__(name, user=None, value=None, **kwds)[source]

galaxy.web.formatting module

galaxy.web.formatting.expand_pretty_datetime_format(value)[source]
>>> expand_pretty_datetime_format("%H:%M:%S %Z")
'%H:%M:%S %Z'
>>> locale_format = expand_pretty_datetime_format("$locale (UTC)")
>>> import locale
>>> expected_format = '%s (UTC)' % locale.nl_langinfo(locale.D_T_FMT)
>>> locale_format == expected_format
True
>>> expand_pretty_datetime_format("$iso8601")
'%Y-%m-%d %H:%M:%S'

galaxy.web.params module

Mixins for parsing web form and API parameters

class galaxy.web.params.BaseParamParser[source]

Bases: object

get_params(kwargs)[source]
class galaxy.web.params.QuotaParamParser[source]

Bases: galaxy.web.params.BaseParamParser

get_quota_params(kwargs)[source]

galaxy.web.statsd_client module

class galaxy.web.statsd_client.GalaxyStatsdClient(statsd_host, statsd_port, statsd_prefix, statsd_influxdb)[source]

Bases: object

__init__(statsd_host, statsd_port, statsd_prefix, statsd_influxdb)[source]
timing(path, time, tags=None)[source]
incr(path, n=1, tags=None)[source]