Skip to content

Commit

Permalink
Enhance to_json such that it can be safely called multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed Apr 19, 2016
1 parent 212f7f4 commit cc49110
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/galaxy/tools/parameters/basic.py
Expand Up @@ -1673,13 +1673,16 @@ def _parse_options( self, input_source ):
def to_json( self, value, app ):
def single_to_json( value ):
src = None
if isinstance( value, galaxy.model.DatasetCollectionElement ):
if isinstance( value, dict ) and 'src' in value and 'id' in value:
return value
elif isinstance( value, galaxy.model.DatasetCollectionElement ):
src = 'dce'
elif isinstance( value, app.model.HistoryDatasetCollectionAssociation ):
src = 'hdca'
else:
elif hasattr( value, 'id' ):
src = 'hda'
return { 'id' : app.security.encode_id( value.id ), 'src' : src }
if src is not None:
return { 'id' : app.security.encode_id( value.id ), 'src' : src }

if value not in [ None, '', 'None' ]:
if isinstance( value, list ) and len( value ) > 0:
Expand Down

0 comments on commit cc49110

Please sign in to comment.