1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/f0651cd048cb/ Changeset: f0651cd048cb User: dan Date: 2014-04-09 23:24:56 Summary: Improve handling of invalid/expired GenomeSpace tokens in GenomeSpace export tool. Affected #: 2 files diff -r 63a81f21363325ebbefc321350315804b15bc79e -r f0651cd048cb4ba8a472361d9e7cc8413d9dcd2b tools/genomespace/genomespace_exporter.py --- a/tools/genomespace/genomespace_exporter.py +++ b/tools/genomespace/genomespace_exporter.py @@ -11,6 +11,7 @@ import os import urllib import urllib2 +from urlparse import urljoin log = logging.getLogger( "tools.genomespace.genomespace_exporter" )#( __name__ ) @@ -117,7 +118,7 @@ break return webtools -def galaxy_code_get_genomespace_folders( genomespace_site='prod', trans=None, value=None, **kwd ): +def galaxy_code_get_genomespace_folders( genomespace_site='prod', trans=None, value=None, base_url=None, **kwd ): if value: value = value[0]#single select, only 1 value def recurse_directory_dict( url_opener, cur_options, url ): @@ -142,19 +143,19 @@ if trans and trans.user: username = trans.user.preferences.get( 'genomespace_username', None ) token = trans.user.preferences.get( 'genomespace_token', None ) - if None in ( username, token ): - return [] - url_opener = get_cookie_opener( username, token ) - genomespace_site_dict = get_genomespace_site_urls()[ genomespace_site ] - dm_url = genomespace_site_dict['dmServer'] - #get export root directory - #directory_dict = get_default_directory( url_opener, dm_url ).get( 'directory', None ) #This directory contains shares and other items outside of the users home - directory_dict = get_personal_directory( url_opener, dm_url ).get( 'directory', None ) #Limit export list to only user's home dir - if directory_dict is None: - return [] - #what directory to stuff this in - recurse_directory_dict( url_opener, rval, directory_dict.get( 'url' ) ) - + if None not in ( username, token ): + url_opener = get_cookie_opener( username, token ) + genomespace_site_dict = get_genomespace_site_urls()[ genomespace_site ] + dm_url = genomespace_site_dict['dmServer'] + #get export root directory + #directory_dict = get_default_directory( url_opener, dm_url ).get( 'directory', None ) #This directory contains shares and other items outside of the users home + directory_dict = get_personal_directory( url_opener, dm_url ).get( 'directory', None ) #Limit export list to only user's home dir + if directory_dict is not None: + recurse_directory_dict( url_opener, rval, directory_dict.get( 'url' ) ) + if not rval: + if not base_url: + base_url = '..' + rval = [ { 'name':'Your GenomeSpace token appears to be <strong>expired</strong>, please <a href="%s">reauthenticate</a>.' % ( urljoin( base_url, 'user/openid_auth?openid_provider=genomespace&auto_associate=True' ) ), 'value': '', 'options':[], 'selected': False } ] return rval diff -r 63a81f21363325ebbefc321350315804b15bc79e -r f0651cd048cb4ba8a472361d9e7cc8413d9dcd2b tools/genomespace/genomespace_exporter.xml --- a/tools/genomespace/genomespace_exporter.xml +++ b/tools/genomespace/genomespace_exporter.xml @@ -35,14 +35,18 @@ <inputs><param format="data" name="input1" type="data" label="Send this dataset to GenomeSpace" /><param name="base_url" type="baseurl" /> - <param name="subdirectory" type="drill_down" display="radio" hierarchy="exact" multiple="False" optional="True" label="Choose Target Directory" dynamic_options="galaxy_code_get_genomespace_folders( genomespace_site = 'prod', trans=__trans__, value=__value__, input_dataset=input1 )" help="Leave blank to generate automatically"/> + <param name="subdirectory" type="drill_down" display="radio" hierarchy="exact" multiple="False" optional="True" label="Choose Target Directory" dynamic_options="galaxy_code_get_genomespace_folders( genomespace_site = 'prod', trans=__trans__, value=__value__, input_dataset=input1, base_url=base_url )" help="Leave blank to generate automatically"/><param name="filename" type="text" size="80" help="Leave blank to generate automatically" /></inputs><outputs><data format="html" name="output_log" /></outputs><help> - This Tool allows you to export data to GenomeSpace. You must have logged in using your GenomeSpace OpenID. You can associate your OpenID credentials under the User Preferences panel. +This Tool allows you to export data to GenomeSpace. You must have logged in using your GenomeSpace OpenID. You can associate your OpenID credentials under the User Preferences panel. + +If you are having trouble with this tool, click here_ to refresh your GenomeSpace token before reporting errors. + +.. _here: ${static_path}/../user/openid_auth?openid_provider=genomespace&auto_associate=True </help><options refresh="True"/><code file="genomespace_exporter.py" /> 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.