Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with lowercasing in datatypes/registry.py #2361

Merged
merged 2 commits into from
May 16, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions lib/galaxy/datatypes/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@ def __import_module( full_path, datatype_module, datatype_class_name ):
for elem in registration.findall( 'datatype' ):
# Keep a status of the process steps to enable stopping the process of handling the datatype if necessary.
ok = True
extension = elem.get( 'extension', None )
if extension:
extension = extension.lower()
extension = self.get_extension( elem )
dtype = elem.get( 'type', None )
type_extension = elem.get( 'type_extension', None )
mimetype = elem.get( 'mimetype', None )
Expand Down Expand Up @@ -552,7 +550,7 @@ def load_display_applications( self, app, installed_repository_dict=None, deacti
# Load display applications defined by local datatypes_conf.xml.
datatype_elems = self.display_app_containers
for elem in datatype_elems:
extension = elem.get( 'extension', None )
extension = self.get_extension( elem )
for display_app in elem.findall( 'display' ):
display_file = display_app.get( 'file', None )
if installed_repository_dict:
Expand Down Expand Up @@ -861,3 +859,17 @@ def to_xml_file( self ):
os.write( fd, '</datatypes>\n' )
os.close( fd )
os.chmod( self.xml_filename, 0o644 )

def get_extension( self, elem ):
"""
Function which returns the extension lowercased
:param elem:
:return extension:
"""
extension = elem.get('extension', None)
# If extension is not None and is uppercase or mixed case, we need to lowercase it
if extension is not None and not extension.islower():
self.log.debug( "%s is not lower case, that could cause troubles in the future. \
Please change it to lower case" % extension )
extension = extension.lower()
return extension