2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/45a70edb67ba/ Changeset: 45a70edb67ba User: dan Date: 2013-05-03 22:02:39 Summary: Provide user to tools as __user__. Affected #: 2 files diff -r b5ea0e100bdaf47d53d11fa2beb39f4218fa8136 -r 45a70edb67baae53fa97de95b4e39004687a0c23 lib/galaxy/jobs/__init__.py --- a/lib/galaxy/jobs/__init__.py +++ b/lib/galaxy/jobs/__init__.py @@ -678,13 +678,16 @@ # These can be passed on the command line if wanted as $__user_*__ if job.history and job.history.user: + user = job.history.user user_id = '%d' % job.history.user.id user_email = str(job.history.user.email) user_name = str(job.history.user.username) else: + user = None user_id = 'Anonymous' user_email = 'Anonymous' user_name = 'Anonymous' + incoming['__user__'] = user incoming['__user_id__'] = incoming['userId'] = user_id incoming['__user_email__'] = incoming['userEmail'] = user_email incoming['__user_name__'] = user_name diff -r b5ea0e100bdaf47d53d11fa2beb39f4218fa8136 -r 45a70edb67baae53fa97de95b4e39004687a0c23 lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -2546,6 +2546,7 @@ param_dict['__root_dir__'] = param_dict['GALAXY_ROOT_DIR'] = os.path.abspath( self.app.config.root ) param_dict['__datatypes_config__'] = param_dict['GALAXY_DATATYPES_CONF_FILE'] = self.app.datatypes_registry.integrated_datatypes_configs param_dict['__admin_users__'] = self.app.config.admin_users + param_dict['__user__'] = RawObjectWrapper( param_dict.get( '__user__', None ) ) # Return the dictionary of parameters return param_dict def build_param_file( self, param_dict, directory=None ): @@ -3243,6 +3244,8 @@ """ def __init__( self, obj ): self.obj = obj + def __nonzero__( self ): + return bool( self.obj ) #FIXME: would it be safe/backwards compatible to rename .obj to .value, so that we can just inherit this method? def __str__( self ): return "%s:%s" % (self.obj.__module__, self.obj.__class__.__name__) def __getattr__( self, key ): https://bitbucket.org/galaxy/galaxy-central/commits/e7feb8e93b6e/ Changeset: e7feb8e93b6e User: dan Date: 2013-05-03 22:02:40 Summary: Update GenomeSpace tools to use __user__ as needed. Affected #: 2 files diff -r 45a70edb67baae53fa97de95b4e39004687a0c23 -r e7feb8e93b6e862b8b450dc5a9636297cea28516 tools/genomespace/genomespace_exporter.xml --- a/tools/genomespace/genomespace_exporter.xml +++ b/tools/genomespace/genomespace_exporter.xml @@ -3,10 +3,9 @@ <description> - send data to GenomeSpace</description><command interpreter="python">genomespace_exporter.py --genomespace_site "prod" - #assert $__user_id__ != 'Anonymous', Exception( 'You must be logged in to use this tool.' ) - #set $user = $__app__.model.User.get( $__user_id__ ) - #set $username = $user.preferences.get( 'genomespace_username', None ) - #set $token = $user.preferences.get( 'genomespace_token', None ) + #assert $__user__, Exception( 'You must be logged in to use this tool.' ) + #set $username = $__user__.preferences.get( 'genomespace_username', None ) + #set $token = $__user__.preferences.get( 'genomespace_token', None ) #assert None not in ( $username, $token ), Exception( 'You must associate a GenomeSpace OpenID with your account and log in with it.' ) #import binascii --username "${username}" @@ -36,7 +35,7 @@ <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" 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 )" help="Leave blank to generate automatically"/><param name="filename" type="text" size="80" help="Leave blank to generate automatically" /></inputs><outputs> diff -r 45a70edb67baae53fa97de95b4e39004687a0c23 -r e7feb8e93b6e862b8b450dc5a9636297cea28516 tools/genomespace/genomespace_importer.xml --- a/tools/genomespace/genomespace_importer.xml +++ b/tools/genomespace/genomespace_importer.xml @@ -3,10 +3,9 @@ <description> - receive data from GenomeSpace</description><command interpreter="python">genomespace_importer.py --genomespace_site "prod" - #assert $__user_id__ != 'Anonymous', Exception( 'You must be logged in to use this tool.' ) - #set $user = $__app__.model.User.get( $__user_id__ ) - #set $username = $user.preferences.get( 'genomespace_username', None ) - #set $token = $user.preferences.get( 'genomespace_token', None ) + #assert $__user__, Exception( 'You must be logged in to use this tool.' ) + #set $username = $__user__.preferences.get( 'genomespace_username', None ) + #set $token = $__user__.preferences.get( 'genomespace_token', None ) #assert None not in ( $username, $token ), Exception( 'You must associate a GenomeSpace OpenID with your account and log in with it.' ) --username "${username}" --token "${token}" 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.