2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/4c52a600e88a/ Changeset: 4c52a600e88a Branch: reports_nice_disksize User: martenson Date: 2013-09-27 15:59:19 Summary: Closed branch reports_nice_disksize Affected #: 3 files diff -r 8fdd9081d1b0de8c2739b0183acd812c1c6d890d -r 4c52a600e88a125d83c8966c30063ecaa53c9fbc lib/galaxy/webapps/galaxy/api/folders.py --- a/lib/galaxy/webapps/galaxy/api/folders.py +++ b/lib/galaxy/webapps/galaxy/api/folders.py @@ -52,7 +52,7 @@ o payload's relevant params: - folder_id: This is the parent folder's id (required) """ - log.debug( "FoldersController.create: enter" ) +# log.debug( "FoldersController.create: enter" ) # TODO: Create a single point of exit if possible. For now we only # exit at the end and on exceptions. if 'folder_id' not in payload: @@ -90,7 +90,7 @@ name = v.name, url = url_for( 'folder', id=encoded_id ) ) ) else: - log.debug( "Error creating folder; setting output and status" ) +# log.debug( "Error creating folder; setting output and status" ) trans.response.status = status rval = output return rval diff -r 8fdd9081d1b0de8c2739b0183acd812c1c6d890d -r 4c52a600e88a125d83c8966c30063ecaa53c9fbc lib/galaxy/webapps/galaxy/api/libraries.py --- a/lib/galaxy/webapps/galaxy/api/libraries.py +++ b/lib/galaxy/webapps/galaxy/api/libraries.py @@ -28,7 +28,7 @@ :returns: list of dictionaries containing library information .. seealso:: :attr:`galaxy.model.Library.dict_collection_visible_keys` """ - log.debug( "LibrariesController.index: enter" ) +# log.debug( "LibrariesController.index: enter" ) query = trans.sa_session.query( trans.app.model.Library ) deleted = util.string_as_bool( deleted ) if deleted: @@ -73,7 +73,7 @@ :returns: detailed library information .. seealso:: :attr:`galaxy.model.Library.dict_element_visible_keys` """ - log.debug( "LibraryContentsController.show: enter" ) +# log.debug( "LibraryContentsController.show: enter" ) library_id = id deleted = util.string_as_bool( deleted ) try: diff -r 8fdd9081d1b0de8c2739b0183acd812c1c6d890d -r 4c52a600e88a125d83c8966c30063ecaa53c9fbc lib/galaxy/webapps/galaxy/api/library_contents.py --- a/lib/galaxy/webapps/galaxy/api/library_contents.py +++ b/lib/galaxy/webapps/galaxy/api/library_contents.py @@ -36,8 +36,15 @@ * url: the url to get detailed information on the library item """ rval = [] + params = util.Params( kwd, sanitize=False ) + # Recursive search is on by default. + load_recursively = params.get( 'load_recursively', None ) + if load_recursively is not None and load_recursively.lower() == "false": + load_recursively = False + else: + load_recursively = True current_user_roles = trans.get_current_user_roles() - def traverse( folder ): + def traverse( folder, load_recursively ): admin = trans.user_is_admin() rval = [] for subfolder in folder.active_folders: @@ -47,7 +54,8 @@ subfolder.api_path = folder.api_path + '/' + subfolder.name subfolder.api_type = 'folder' rval.append( subfolder ) - rval.extend( traverse( subfolder ) ) + if load_recursively: + rval.extend( traverse( subfolder, load_recursively ) ) for ld in folder.datasets: if not admin: can_access = trans.app.security_agent.can_access_dataset( @@ -55,12 +63,14 @@ if (admin or can_access) and not ld.deleted: log.debug( "type(folder): %s" % type( folder ) ) log.debug( "type(api_path): %s; folder.api_path: %s" % ( type(folder.api_path), folder.api_path ) ) - #log.debug( "attributes of folder: %s" % str(dir(folder)) ) + log.debug( "attributes of folder: %s" % str(dir(folder)) ) ld.api_path = folder.api_path + '/' + ld.name ld.api_type = 'file' rval.append( ld ) return rval try: + if library_id[0] == 'F': + library_id = library_id[1:] decoded_library_id = trans.security.decode_id( library_id ) except TypeError: trans.response.status = 400 @@ -80,14 +90,17 @@ url = url_for( 'library_content', library_id=library_id, id=encoded_id ) ) ) log.debug( "Root folder attributes: %s" % str(dir(library.root_folder)) ) library.root_folder.api_path = '' - for content in traverse( library.root_folder ): - encoded_id = trans.security.encode_id( content.id ) - if content.api_type == 'folder': - encoded_id = 'F' + encoded_id - rval.append( dict( id = encoded_id, - type = content.api_type, - name = content.api_path, - url = url_for( 'library_content', library_id=library_id, id=encoded_id, ) ) ) + if load_recursively: + for content in traverse( library.root_folder, load_recursively ): + encoded_id = trans.security.encode_id( content.id ) + if content.api_type == 'folder': + encoded_id = 'F' + encoded_id + rval.append( dict( id = encoded_id, + type = content.api_type, + name = content.api_path, + url = url_for( 'library_content', library_id=library_id, id=encoded_id, ) ) ) + else: # We don't load recursively, we need to pass different value to traverse. + pass return rval @web.expose_api https://bitbucket.org/galaxy/galaxy-central/commits/be8a8a9c72f8/ Changeset: be8a8a9c72f8 User: martenson Date: 2013-09-27 16:00:05 Summary: merge Affected #: 3 files diff -r e599b3d6a83347bf1f7a6f5cfadfe541c2c1e035 -r be8a8a9c72f8591ae6311f02314761e4df9fa8e2 lib/galaxy/webapps/galaxy/api/folders.py --- a/lib/galaxy/webapps/galaxy/api/folders.py +++ b/lib/galaxy/webapps/galaxy/api/folders.py @@ -52,7 +52,7 @@ o payload's relevant params: - folder_id: This is the parent folder's id (required) """ - log.debug( "FoldersController.create: enter" ) +# log.debug( "FoldersController.create: enter" ) # TODO: Create a single point of exit if possible. For now we only # exit at the end and on exceptions. if 'folder_id' not in payload: @@ -90,7 +90,7 @@ name = v.name, url = url_for( 'folder', id=encoded_id ) ) ) else: - log.debug( "Error creating folder; setting output and status" ) +# log.debug( "Error creating folder; setting output and status" ) trans.response.status = status rval = output return rval diff -r e599b3d6a83347bf1f7a6f5cfadfe541c2c1e035 -r be8a8a9c72f8591ae6311f02314761e4df9fa8e2 lib/galaxy/webapps/galaxy/api/libraries.py --- a/lib/galaxy/webapps/galaxy/api/libraries.py +++ b/lib/galaxy/webapps/galaxy/api/libraries.py @@ -28,7 +28,7 @@ :returns: list of dictionaries containing library information .. seealso:: :attr:`galaxy.model.Library.dict_collection_visible_keys` """ - log.debug( "LibrariesController.index: enter" ) +# log.debug( "LibrariesController.index: enter" ) query = trans.sa_session.query( trans.app.model.Library ) deleted = util.string_as_bool( deleted ) if deleted: @@ -73,7 +73,7 @@ :returns: detailed library information .. seealso:: :attr:`galaxy.model.Library.dict_element_visible_keys` """ - log.debug( "LibraryContentsController.show: enter" ) +# log.debug( "LibraryContentsController.show: enter" ) library_id = id deleted = util.string_as_bool( deleted ) try: diff -r e599b3d6a83347bf1f7a6f5cfadfe541c2c1e035 -r be8a8a9c72f8591ae6311f02314761e4df9fa8e2 lib/galaxy/webapps/galaxy/api/library_contents.py --- a/lib/galaxy/webapps/galaxy/api/library_contents.py +++ b/lib/galaxy/webapps/galaxy/api/library_contents.py @@ -36,8 +36,15 @@ * url: the url to get detailed information on the library item """ rval = [] + params = util.Params( kwd, sanitize=False ) + # Recursive search is on by default. + load_recursively = params.get( 'load_recursively', None ) + if load_recursively is not None and load_recursively.lower() == "false": + load_recursively = False + else: + load_recursively = True current_user_roles = trans.get_current_user_roles() - def traverse( folder ): + def traverse( folder, load_recursively ): admin = trans.user_is_admin() rval = [] for subfolder in folder.active_folders: @@ -47,7 +54,8 @@ subfolder.api_path = folder.api_path + '/' + subfolder.name subfolder.api_type = 'folder' rval.append( subfolder ) - rval.extend( traverse( subfolder ) ) + if load_recursively: + rval.extend( traverse( subfolder, load_recursively ) ) for ld in folder.datasets: if not admin: can_access = trans.app.security_agent.can_access_dataset( @@ -55,12 +63,14 @@ if (admin or can_access) and not ld.deleted: log.debug( "type(folder): %s" % type( folder ) ) log.debug( "type(api_path): %s; folder.api_path: %s" % ( type(folder.api_path), folder.api_path ) ) - #log.debug( "attributes of folder: %s" % str(dir(folder)) ) + log.debug( "attributes of folder: %s" % str(dir(folder)) ) ld.api_path = folder.api_path + '/' + ld.name ld.api_type = 'file' rval.append( ld ) return rval try: + if library_id[0] == 'F': + library_id = library_id[1:] decoded_library_id = trans.security.decode_id( library_id ) except TypeError: trans.response.status = 400 @@ -80,14 +90,17 @@ url = url_for( 'library_content', library_id=library_id, id=encoded_id ) ) ) log.debug( "Root folder attributes: %s" % str(dir(library.root_folder)) ) library.root_folder.api_path = '' - for content in traverse( library.root_folder ): - encoded_id = trans.security.encode_id( content.id ) - if content.api_type == 'folder': - encoded_id = 'F' + encoded_id - rval.append( dict( id = encoded_id, - type = content.api_type, - name = content.api_path, - url = url_for( 'library_content', library_id=library_id, id=encoded_id, ) ) ) + if load_recursively: + for content in traverse( library.root_folder, load_recursively ): + encoded_id = trans.security.encode_id( content.id ) + if content.api_type == 'folder': + encoded_id = 'F' + encoded_id + rval.append( dict( id = encoded_id, + type = content.api_type, + name = content.api_path, + url = url_for( 'library_content', library_id=library_id, id=encoded_id, ) ) ) + else: # We don't load recursively, we need to pass different value to traverse. + pass return rval @web.expose_api 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.