Skip to content

Commit

Permalink
Sanitize biotools description reformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdbeek authored and nsoranzo committed May 20, 2016
1 parent fb719d1 commit fcabc78
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions lib/galaxy/webapps/galaxy/api/biotools.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,16 @@ def build_tool_name(tool_id, tool_version):

def format_description(description):
"""
Test the first and last char of a description and replace them
with the format adapted to Elixir
:param description: Tool Galaxy description
:return: Formatted tool Galaxy description
Ensure capital first character and final `.` in description.
:param description: tool description
:return: tool description for bio.tools
:rtype: string
"""
try:
size = len(description)
if description[size - 1] == '.':
return description[0].upper() + description[1:size]
else:
return description[0].upper() + description[1:size] + '.'
except IndexError:
raise description
if not description: # Descriptions are not mandatory in galaxy, but they are mandatory in bio.tools
return None
if not description.endswith('.'):
description = "%s." % description
return description


def get_source_registry(tool_id):
Expand Down

0 comments on commit fcabc78

Please sign in to comment.