libraries - removal of id-encoding related bug in API commited in f7ebd14c2f9b260cdb6627e4abfd5c03f14c4900 and identified by jmchilton in https://bitbucket.org/galaxy/galaxy-central/commits/f7ebd14c2f9b260cdb6627e4abfd5c03f14c4900#comment-825140

This commit is contained in:
Martin Cech
2014-03-20 19:26:45 -04:00
parent 134585e8f4
commit 3e62378b2a
2 changed files with 12 additions and 5 deletions
+2 -2
View File
@@ -2078,8 +2078,8 @@ class LibraryFolder( object, Dictifiable, HasName ):
# This needs to be a list
return [ ld for ld in self.datasets if ld.library_dataset_dataset_association and not ld.library_dataset_dataset_association.dataset.deleted ]
def to_dict( self, view='collection' ):
rval = super( LibraryFolder, self ).to_dict( view=view )
def to_dict( self, view='collection', value_mapper=None ):
rval = super( LibraryFolder, self ).to_dict( view=view, value_mapper=value_mapper )
info_association, inherited = self.get_info_association()
if info_association:
if inherited:
@@ -123,11 +123,18 @@ class LibraryContentsController( BaseAPIController, UsesLibraryMixin, UsesLibrar
class_name, content_id = self.__decode_library_content_id( trans, id )
if class_name == 'LibraryFolder':
content = self.get_library_folder( trans, content_id, check_ownership=False, check_accessible=True )
rval = content.to_dict( view='element', value_mapper={ 'id' : trans.security.encode_id } )
rval[ 'id' ] = 'F' + str( rval[ 'id' ] )
rval[ 'parent_id' ] = 'F' + str( trans.security.encode_id( rval[ 'parent_id' ] ) )
rval[ 'parent_library_id' ] = trans.security.encode_id( rval[ 'parent_library_id' ] )
else:
content = self.get_library_dataset( trans, content_id, check_ownership=False, check_accessible=True )
return content.to_dict( view='element', value_mapper={ 'id' : trans.security.encode_id } )
# return self.encode_all_ids( trans, content.to_dict( view='element' ) )
rval = content.to_dict( view='element')
rval[ 'id' ] = trans.security.encode_id( rval[ 'id' ] )
rval[ 'ldda_id' ] = trans.security.encode_id( rval[ 'ldda_id' ] )
rval[ 'folder_id' ] = 'F' + str( trans.security.encode_id( rval[ 'folder_id' ] ) )
rval[ 'parent_library_id' ] = trans.security.encode_id( rval[ 'parent_library_id' ] )
return rval
@web.expose_api
def create( self, trans, library_id, payload, **kwd ):