commit/galaxy-central: greg: Keep track of category associations when exporting repositories from the tool shed.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/f760fca38915/ Changeset: f760fca38915 User: greg Date: 2013-08-06 17:04:54 Summary: Keep track of category associations when exporting repositories from the tool shed. Affected #: 2 files diff -r b9a24a719716150910de19eefd1189238c243255 -r f760fca38915be8d0ae8f94e703a6d83302065f8 lib/tool_shed/util/export_util.py --- a/lib/tool_shed/util/export_util.py +++ b/lib/tool_shed/util/export_util.py @@ -246,6 +246,12 @@ 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 ): diff -r b9a24a719716150910de19eefd1189238c243255 -r f760fca38915be8d0ae8f94e703a6d83302065f8 lib/tool_shed/util/xml_util.py --- a/lib/tool_shed/util/xml_util.py +++ b/lib/tool_shed/util/xml_util.py @@ -62,7 +62,18 @@ # 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 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.
participants (1)
-
commits-noreply@bitbucket.org