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.helpers package¶
Galaxy web framework helpers
The functions in this module should be considered part of the API used by visualizations in their mako files through the $h object, see GalaxyWebTransaction in galaxy/webapps/base/webapp.py
- galaxy.web.framework.helpers.truncate(content, length=100, suffix='...')[source]¶
Smart string truncation
- 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.dist_css(*args)[source]¶
Transition function ‘css’ helper – this is the modern way where all bundled artifacts are in the unified ‘dist’.
- 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.dist_js(*args)[source]¶
Take a prefix and list of javascript names and return appropriate string of script tags.
- 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.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.to_js_bool(val)[source]¶
Prints javascript boolean for passed value. TODO: isn’t there a standard python JSON parser we should be using instead of all these manual conversions?
- galaxy.web.framework.helpers.js_nullable(val)[source]¶
Prints javascript null instead of python None TODO: isn’t there a standard python JSON parser we should be using instead of all these manual conversions?
Submodules¶
galaxy.web.framework.helpers.grids module¶
- 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, target=None, delayed=False)[source]¶
Bases:
object
- 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, target=None, delayed=False)[source]¶
Bases:
GridColumn
Column that reverses sorting; this is useful when the natural sort is descending.
- 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, target=None, delayed=False)[source]¶
Bases:
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.
- 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, target=None, delayed=False)[source]¶
Bases:
TextColumn
- 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, target=None, delayed=False)[source]¶
Bases:
TextColumn
- 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, target=None, delayed=False)[source]¶
Bases:
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.
- 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, target=None, delayed=False)[source]¶
Bases:
GridColumn
,UsesItemRatings
Column that displays community ratings for an item.
- class galaxy.web.framework.helpers.grids.OwnerAnnotationColumn(col_name, key, model_class=None, model_annotation_association_class=None, filterable=None)[source]¶
Bases:
TextColumn
,UsesAnnotations
Column that displays and filters item owner’s annotations.
- 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:
TextColumn
Column that supports community tags.
- __init__(col_name, key, model_class=None, model_tag_association_class=None, filterable=None, grid_name=None)[source]¶
Create a grid column.
- 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:
CommunityTagsColumn
Column that supports individual tags.
- class galaxy.web.framework.helpers.grids.MulticolFilterColumn(col_name, cols_to_filter, key, visible, filterable='default')[source]¶
Bases:
TextColumn
Column that performs multicolumn filtering.
- 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, target=None, delayed=False)[source]¶
Bases:
TextColumn
Column that lists item’s owner.
- 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, target=None, delayed=False)[source]¶
Bases:
TextColumn
Column displays item’s public URL based on username and slug.
- 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, target=None, delayed=False)[source]¶
Bases:
GridColumn
Column that tracks and filters for items with deleted attribute.
- class galaxy.web.framework.helpers.grids.PurgedColumn(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, target=None, delayed=False)[source]¶
Bases:
GridColumn
Column that tracks and filters for items with purged attribute.
- 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, target=None, delayed=False)[source]¶
Bases:
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.
- class galaxy.web.framework.helpers.grids.SharingStatusColumn(*args, **kwargs)[source]¶
Bases:
GridColumn
Grid column to indicate sharing status.
- 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)[source]¶
Bases:
object
- 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)[source]¶
Bases:
GridOperation
Operation to display an item by username and slug.
- class galaxy.web.framework.helpers.grids.GridAction(label=None, url_args=None, target=None)[source]¶
Bases:
object
- class galaxy.web.framework.helpers.grids.Grid[source]¶
Bases:
object
Specifies the content and format of a grid (data table).
- title = ''¶
- show_item_checkboxes = False¶
- use_hide_message = True¶
- global_actions: List[GridAction] = []¶
- columns: List[GridColumn] = []¶
- operations: List[GridOperation] = []¶
- standard_filters: List[GridColumnFilter] = []¶
- use_paging = False¶
- num_rows_per_page = 25¶
- num_page_links = 10¶
- cur_filter_pref_name = '.filter'¶
- cur_sort_key_pref_name = '.sort_key'¶
- legend = None¶