mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Keep track of category associations when exporting repositories from the tool shed.
This commit is contained in:
@@ -246,6 +246,12 @@ def get_repository_attributes_and_sub_elements( repository, archive_name ):
|
||||
sub_elements[ 'description' ] = str( repository.description )
|
||||
sub_elements[ 'long_description' ] = str( repository.long_description )
|
||||
sub_elements[ 'archive' ] = archive_name
|
||||
# Keep track of Category associations.
|
||||
categories = []
|
||||
for rca in repository.categories:
|
||||
category = rca.category
|
||||
categories.append( ( 'category', str( category.name ) ) )
|
||||
sub_elements[ 'categories' ] = categories
|
||||
return attributes, sub_elements
|
||||
|
||||
def get_repository_ids( trans, repo_info_dicts ):
|
||||
|
||||
@@ -62,7 +62,18 @@ def create_element( tag, attributes=None, sub_elements=None ):
|
||||
# Don't include fields that are blank.
|
||||
if v:
|
||||
sub_elem = XmlET.SubElement( elem, k )
|
||||
sub_elem.text = v
|
||||
if isinstance( v, list ):
|
||||
# If the sub_elem is a list, then it must be a list of tuples where the first item is the tag and the second item is the text value.
|
||||
for v_tuple in v:
|
||||
if len( v_tuple ) == 2:
|
||||
v_tag = v_tuple[ 0 ]
|
||||
v_text = v_tuple[ 1 ]
|
||||
# Don't include fields that are blank.
|
||||
if v_text:
|
||||
v_elem = XmlET.SubElement( sub_elem, v_tag )
|
||||
v_elem.text = v_text
|
||||
else:
|
||||
sub_elem.text = v
|
||||
return elem
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user