Skip to content

Commit

Permalink
Add restore as deprecated old path to RDF.
Browse files Browse the repository at this point in the history
It will be in many old datatype_conf.xml files so perhaps it should be deprecated before removing it completely. Using this new infrastructure - people will be warned if the they load it from the old location and told to update datatypes_conf.xml to reference the new location.
  • Loading branch information
jmchilton committed Jun 24, 2015
1 parent e097de3 commit e714759
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/galaxy/datatypes/data.py
Expand Up @@ -46,6 +46,26 @@ def __init__( cls, name, bases, dict_ ):
metadata.Statement.process( cls )


def deprecated_datatype_reference(klass):
""" Decorate an older class location to indicate that the class has been
moved to a new module. See graph.py as an example.
"""
old_init = klass.__init__

def new_init(self, *args, **kwargs):
old_location = "%s.%s" % (klass.__module__, klass.__name__)
new_klass = klass.__bases__[0]
new_location = "%s.%s" % (new_klass.__module__, new_klass.__name__)
message = "Using deprecated reference to class [%s] " % old_location
message += "update datatype configuration to reference [%s]" % new_location
log.warn(message)
old_init(self, *args, **kwargs)

klass.__init__ = new_init

return klass


@dataproviders.decorators.has_dataproviders
class Data( object ):
"""
Expand Down
6 changes: 6 additions & 0 deletions lib/galaxy/datatypes/graph.py
Expand Up @@ -8,6 +8,7 @@

import dataproviders
from galaxy.util import simplegraph
from . import triples

import logging
log = logging.getLogger( __name__ )
Expand Down Expand Up @@ -159,3 +160,8 @@ def __iter__( self ):
graph.add_edge( source_id, target_id, type=relation )

yield graph.as_dict()


@data.deprecated_datatype_reference
class Rdf(triples.Rdf):
pass

0 comments on commit e714759

Please sign in to comment.