3 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/d6ab0870547c/ Changeset: d6ab0870547c User: dannon Date: 2013-04-02 20:41:10 Summary: Library controller code cleanup, imports and spacing. Affected #: 1 file diff -r f03401b61bc6825131b163b9bb8cf1acf8ac48c3 -r d6ab0870547c5342b101d2a97513da699ef4ae39 lib/galaxy/webapps/galaxy/controllers/library.py --- a/lib/galaxy/webapps/galaxy/controllers/library.py +++ b/lib/galaxy/webapps/galaxy/controllers/library.py @@ -1,24 +1,27 @@ -import urllib, urllib2 +import logging +from galaxy import model, util +from galaxy import web +from galaxy.model.orm import and_, not_, or_ +from galaxy.web.base.controller import BaseUIController +from galaxy.web.framework.helpers import grids +from library_common import get_comptypes, lucene_search, whoosh_search -from galaxy.web.base.controller import * -from galaxy.web.framework.helpers import time_ago, iff, grids -from galaxy.model.orm import * -from galaxy.datatypes import sniff -from galaxy import model, util -from galaxy.util.odict import odict -from library_common import get_comptypes, lucene_search, whoosh_search log = logging.getLogger( __name__ ) + class LibraryListGrid( grids.Grid ): + class NameColumn( grids.TextColumn ): def get_value( self, trans, grid, library ): return library.name + class DescriptionColumn( grids.TextColumn ): def get_value( self, trans, grid, library ): if library.description: return library.description return '' + # Grid definition title = "Data Libraries" model_class = model.Library @@ -45,8 +48,10 @@ num_rows_per_page = 50 preserve_state = False use_paging = True + def build_initial_query( self, trans, **kwargs ): return trans.sa_session.query( self.model_class ).filter( self.model_class.table.c.deleted == False ) + def apply_query_filter( self, trans, query, **kwd ): current_user_role_ids = [ role.id for role in trans.get_current_user_roles() ] library_access_action = trans.app.security_agent.permitted_actions.LIBRARY_ACCESS.action @@ -65,8 +70,10 @@ # public libraries and restricted libraries accessible by the current user. return query.filter( or_( not_( trans.model.Library.table.c.id.in_( restricted_library_ids ) ), trans.model.Library.table.c.id.in_( accessible_restricted_library_ids ) ) ) + + class Library( BaseUIController ): - + library_list_grid = LibraryListGrid() @web.expose https://bitbucket.org/galaxy/galaxy-central/commits/8a84382c5c33/ Changeset: 8a84382c5c33 User: dannon Date: 2013-04-02 20:41:55 Summary: Trim trailing whitespace. Affected #: 1 file diff -r d6ab0870547c5342b101d2a97513da699ef4ae39 -r 8a84382c5c339eee6c866301bae613bb4a2b0595 lib/galaxy/webapps/galaxy/controllers/library.py --- a/lib/galaxy/webapps/galaxy/controllers/library.py +++ b/lib/galaxy/webapps/galaxy/controllers/library.py @@ -38,8 +38,8 @@ attach_popup=False, filterable="advanced" ), ] - columns.append( grids.MulticolFilterColumn( "search dataset name, info, message, dbkey", - cols_to_filter=[ columns[0], columns[1] ], + columns.append( grids.MulticolFilterColumn( "search dataset name, info, message, dbkey", + cols_to_filter=[ columns[0], columns[1] ], key="free-text-search", visible=False, filterable="standard" ) ) @@ -62,11 +62,11 @@ .filter( and_( trans.model.LibraryPermissions.table.c.action == library_access_action, trans.model.LibraryPermissions.table.c.role_id.in_( current_user_role_ids ) ) ) ] if not trans.user: - # Filter to get only public libraries, a library whose id + # Filter to get only public libraries, a library whose id # is not in restricted_library_ids is a public library return query.filter( not_( trans.model.Library.table.c.id.in_( restricted_library_ids ) ) ) else: - # Filter to get libraries accessible by the current user, get both + # Filter to get libraries accessible by the current user, get both # public libraries and restricted libraries accessible by the current user. return query.filter( or_( not_( trans.model.Library.table.c.id.in_( restricted_library_ids ) ), trans.model.Library.table.c.id.in_( accessible_restricted_library_ids ) ) ) https://bitbucket.org/galaxy/galaxy-central/commits/d62c5edf1ef2/ Changeset: d62c5edf1ef2 User: dannon Date: 2013-04-02 20:47:12 Summary: Merge Affected #: 6 files This diff is so big that we needed to truncate the remainder. Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.