1 new changeset in galaxy-central: http://bitbucket.org/galaxy/galaxy-central/changeset/34d3fcd8037b/ changeset: r5176:34d3fcd8037b user: dan date: 2011-03-04 16:28:04 summary: Add a 'subclass' flag to datatype definitions in datatypes_conf.xml that allows dynamic creation of a subclass. For example, to create a datatype that has the attributes of a Tabular file, but is more 'specific': <datatype extension="more_than_tabular" type="galaxy.datatypes.tabular:Tabular" subclass="True" /> affected #: 1 file (281 bytes) --- a/lib/galaxy/datatypes/registry.py Fri Mar 04 10:02:01 2011 -0500 +++ b/lib/galaxy/datatypes/registry.py Fri Mar 04 10:28:04 2011 -0500 @@ -48,20 +48,24 @@ dtype = elem.get( 'type', None ) mimetype = elem.get( 'mimetype', None ) display_in_upload = elem.get( 'display_in_upload', False ) + make_subclass = galaxy.util.string_as_bool( elem.get( 'subclass', False ) ) if extension and dtype: fields = dtype.split( ':' ) datatype_module = fields[0] - datatype_class = fields[1] + datatype_class_name = fields[1] fields = datatype_module.split( '.' ) module = __import__( fields.pop(0) ) for mod in fields: module = getattr( module, mod ) - self.datatypes_by_extension[extension] = getattr( module, datatype_class )() + datatype_class = getattr( module, datatype_class_name ) + if make_subclass: + datatype_class = type( datatype_class_name, (datatype_class,), {} ) + self.datatypes_by_extension[extension] = datatype_class() if mimetype is None: # Use default mime type as per datatype spec mimetype = self.datatypes_by_extension[extension].get_mime() self.mimetypes_by_extension[extension] = mimetype - if hasattr( getattr( module, datatype_class ), "get_track_type" ): + if hasattr( datatype_class, "get_track_type" ): self.available_tracks.append( extension ) if display_in_upload: self.upload_file_formats.append( extension ) 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.