helpers Package

helpers Package

Galaxy web framework helpers

galaxy.web.framework.helpers.css(*args)[source]

Take a list of stylesheet names (no extension) and return appropriate string of link tags.

Cache-bust with time that server started running on

galaxy.web.framework.helpers.iff(a, b, c)[source]

Ternary shortcut

galaxy.web.framework.helpers.is_true(val)[source]

Returns true if input is a boolean and true or is a string and looks like a true value.

galaxy.web.framework.helpers.js(*args)[source]

Take a prefix and list of javascript names and return appropriate string of script tags.

galaxy.web.framework.helpers.js_helper(prefix, *args)[source]

Take a prefix and list of javascript names and return appropriate string of script tags.

Cache-bust with time that server started running on

galaxy.web.framework.helpers.md5(s)[source]

Return hex encoded md5 hash of string s

galaxy.web.framework.helpers.templates(*args)[source]

Take a list of template names (no extension) and return appropriate string of script tags.

galaxy.web.framework.helpers.time_ago(x)[source]

Convert a datetime to a string.

galaxy.web.framework.helpers.to_unicode(a_string)[source]

Convert a string to unicode in utf-8 format; if string is already unicode, does nothing because string’s encoding cannot be determined by introspection.

galaxy.web.framework.helpers.truncate(content, length=100, suffix='...')[source]

Smart string truncation

grids Module

class galaxy.web.framework.helpers.grids.BooleanColumn(label, key=None, model_class=None, method=None, format=None, link=None, attach_popup=False, visible=True, nowrap=False, filterable=None, sortable=True, label_id_prefix=None, inbound=False)[source]

Bases: galaxy.web.framework.helpers.grids.TextColumn

get_single_filter(user, a_filter)[source]
sort(trans, query, ascending, column_name=None)[source]

Sort query using this column.

class galaxy.web.framework.helpers.grids.CommunityRatingColumn(label, key=None, model_class=None, method=None, format=None, link=None, attach_popup=False, visible=True, nowrap=False, filterable=None, sortable=True, label_id_prefix=None, inbound=False)[source]

Bases: galaxy.web.framework.helpers.grids.GridColumn, galaxy.model.item_attrs.UsesItemRatings

Column that displays community ratings for an item.

get_value(trans, grid, item)[source]
sort(trans, query, ascending, column_name=None)[source]
class galaxy.web.framework.helpers.grids.CommunityTagsColumn(col_name, key, model_class=None, model_tag_association_class=None, filterable=None, grid_name=None)[source]

Bases: galaxy.web.framework.helpers.grids.TextColumn

Column that supports community tags.

filter(trans, user, query, column_filter)[source]

Modify query to filter model_class by tag. Multiple filters are ANDed.

get_filter(trans, user, column_filter)[source]
get_value(trans, grid, item)[source]
class galaxy.web.framework.helpers.grids.DateTimeColumn(label, key=None, model_class=None, method=None, format=None, link=None, attach_popup=False, visible=True, nowrap=False, filterable=None, sortable=True, label_id_prefix=None, inbound=False)[source]

Bases: galaxy.web.framework.helpers.grids.TextColumn

sort(trans, query, ascending, column_name=None)[source]

Sort query using this column.

class galaxy.web.framework.helpers.grids.DeletedColumn(label, key=None, model_class=None, method=None, format=None, link=None, attach_popup=False, visible=True, nowrap=False, filterable=None, sortable=True, label_id_prefix=None, inbound=False)[source]

Bases: galaxy.web.framework.helpers.grids.GridColumn

Column that tracks and filters for items with deleted attribute.

filter(trans, user, query, column_filter)[source]

Modify query to filter self.model_class by state.

get_accepted_filters()[source]

Returns a list of accepted filters for this column.

class galaxy.web.framework.helpers.grids.DisplayByUsernameAndSlugGridOperation(label, key=None, condition=None, allow_multiple=True, allow_popup=True, target=None, url_args=None, async_compatible=False, confirm=None, global_operation=None, inbound=False)[source]

Bases: galaxy.web.framework.helpers.grids.GridOperation

Operation to display an item by username and slug.

get_url_args(item)[source]
class galaxy.web.framework.helpers.grids.Grid[source]

Bases: object

Specifies the content and format of a grid (data table).

apply_query_filter(trans, query, **kwargs)[source]
async_template = 'grid_base_async.mako'
build_initial_query(trans, **kwargs)[source]
columns = []
cur_filter_pref_name = '.filter'
cur_sort_key_pref_name = '.sort_key'
default_filter = {}
default_sort_key = None
exposed = True
get_current_item(trans, **kwargs)[source]
get_ids(**kwargs)[source]
global_actions = []
handle_operation(trans, operation, ids, **kwargs)[source]
info_text = None
legend = None
model_class = None
num_rows_per_page = 25
operations = []
pass_through_operations = {}
preserve_state = False
show_item_checkboxes = False
standard_filters = []
template = 'grid_base.mako'
title = ''
use_async = False
use_hide_message = True
use_paging = False
class galaxy.web.framework.helpers.grids.GridAction(label=None, url_args=None, inbound=False)[source]

Bases: object

class galaxy.web.framework.helpers.grids.GridColumn(label, key=None, model_class=None, method=None, format=None, link=None, attach_popup=False, visible=True, nowrap=False, filterable=None, sortable=True, label_id_prefix=None, inbound=False)[source]

Bases: object

filter(trans, user, query, column_filter)[source]

Modify query to reflect the column filter.

get_accepted_filters()[source]

Returns a list of accepted filters for this column.

get_value(trans, grid, item)[source]
sort(trans, query, ascending, column_name=None)[source]

Sort query using this column.

class galaxy.web.framework.helpers.grids.GridColumnFilter(label, args=None)[source]

Bases: object

get_url_args()[source]
class galaxy.web.framework.helpers.grids.GridOperation(label, key=None, condition=None, allow_multiple=True, allow_popup=True, target=None, url_args=None, async_compatible=False, confirm=None, global_operation=None, inbound=False)[source]

Bases: object

allowed(item)[source]
get_url_args(item)[source]
class galaxy.web.framework.helpers.grids.IndividualTagsColumn(col_name, key, model_class=None, model_tag_association_class=None, filterable=None, grid_name=None)[source]

Bases: galaxy.web.framework.helpers.grids.CommunityTagsColumn

Column that supports individual tags.

get_filter(trans, user, column_filter)[source]
get_value(trans, grid, item)[source]
class galaxy.web.framework.helpers.grids.IntegerColumn(label, key=None, model_class=None, method=None, format=None, link=None, attach_popup=False, visible=True, nowrap=False, filterable=None, sortable=True, label_id_prefix=None, inbound=False)[source]

Bases: galaxy.web.framework.helpers.grids.TextColumn

Integer column that employs freetext, but checks that the text is an integer, so support filtering on integer values.

IMPORTANT NOTE: grids that use this column type should not include the column in the cols_to_filter list of MulticolFilterColumn ( i.e., searching on this column type should not be performed in the grid’s standard search - it won’t throw exceptions, but it also will not find what you’re looking for ). Grids that search on this column should use ‘filterable=”advanced”’ so that searching is only performed in the advanced search component, restricting the search to the specific column.

This is useful for searching on object ids or other integer columns. See the JobIdColumn column in the SpecifiedDateListGrid class in the jobs controller of the reports webapp for an example.

get_single_filter(user, a_filter)[source]
sort(trans, query, ascending, column_name=None)[source]

Sort query using this column.

class galaxy.web.framework.helpers.grids.MulticolFilterColumn(col_name, cols_to_filter, key, visible, filterable='default')[source]

Bases: galaxy.web.framework.helpers.grids.TextColumn

Column that performs multicolumn filtering.

filter(trans, user, query, column_filter)[source]

Modify query to filter model_class by tag. Multiple filters are ANDed.

class galaxy.web.framework.helpers.grids.OwnerAnnotationColumn(col_name, key, model_class=None, model_annotation_association_class=None, filterable=None)[source]

Bases: galaxy.web.framework.helpers.grids.TextColumn, galaxy.model.item_attrs.UsesAnnotations

Column that displays and filters item owner’s annotations.

get_single_filter(user, a_filter)[source]

Filter by annotation and annotation owner.

get_value(trans, grid, item)[source]

Returns first 150 characters of annotation.

class galaxy.web.framework.helpers.grids.OwnerColumn(label, key=None, model_class=None, method=None, format=None, link=None, attach_popup=False, visible=True, nowrap=False, filterable=None, sortable=True, label_id_prefix=None, inbound=False)[source]

Bases: galaxy.web.framework.helpers.grids.TextColumn

Column that lists item’s owner.

get_value(trans, grid, item)[source]
sort(trans, query, ascending, column_name=None)[source]

Sort column using case-insensitive alphabetical sorting on item’s username.

class galaxy.web.framework.helpers.grids.PublicURLColumn(label, key=None, model_class=None, method=None, format=None, link=None, attach_popup=False, visible=True, nowrap=False, filterable=None, sortable=True, label_id_prefix=None, inbound=False)[source]

Bases: galaxy.web.framework.helpers.grids.TextColumn

Column displays item’s public URL based on username and slug.

class galaxy.web.framework.helpers.grids.ReverseSortColumn(label, key=None, model_class=None, method=None, format=None, link=None, attach_popup=False, visible=True, nowrap=False, filterable=None, sortable=True, label_id_prefix=None, inbound=False)[source]

Bases: galaxy.web.framework.helpers.grids.GridColumn

Column that reverses sorting; this is useful when the natural sort is descending.

sort(trans, query, ascending, column_name=None)[source]
class galaxy.web.framework.helpers.grids.SharingStatusColumn(label, key=None, model_class=None, method=None, format=None, link=None, attach_popup=False, visible=True, nowrap=False, filterable=None, sortable=True, label_id_prefix=None, inbound=False)[source]

Bases: galaxy.web.framework.helpers.grids.GridColumn

Grid column to indicate sharing status.

filter(trans, user, query, column_filter)[source]

Modify query to filter histories by sharing status.

get_accepted_filters()[source]

Returns a list of accepted filters for this column.

get_value(trans, grid, item)[source]
class galaxy.web.framework.helpers.grids.StateColumn(label, key=None, model_class=None, method=None, format=None, link=None, attach_popup=False, visible=True, nowrap=False, filterable=None, sortable=True, label_id_prefix=None, inbound=False)[source]

Bases: galaxy.web.framework.helpers.grids.GridColumn

Column that tracks and filters for items with state attribute.

IMPORTANT NOTE: self.model_class must have a states Bunch or dict if this column type is used in the grid.

filter(trans, user, query, column_filter)[source]

Modify query to filter self.model_class by state.

get_accepted_filters()[source]

Returns a list of accepted filters for this column.

get_value(trans, grid, item)[source]
class galaxy.web.framework.helpers.grids.TextColumn(label, key=None, model_class=None, method=None, format=None, link=None, attach_popup=False, visible=True, nowrap=False, filterable=None, sortable=True, label_id_prefix=None, inbound=False)[source]

Bases: galaxy.web.framework.helpers.grids.GridColumn

Generic column that employs freetext and, hence, supports freetext, case-independent filtering.

filter(trans, user, query, column_filter)[source]

Modify query to filter using free text, case independence.

get_filter(trans, user, column_filter)[source]

Returns a SQLAlchemy criterion derived from column_filter.

get_single_filter(user, a_filter)[source]

Returns a SQLAlchemy criterion derived for a single filter. Single filter is the most basic filter–usually a string–and cannot be a list.

sort(trans, query, ascending, column_name=None)[source]

Sort column using case-insensitive alphabetical sorting.