(fqn, subclass)
return cls
Dynamically load fqn class and verify it's a subclass of subclass
Dynamically load fqn class and verify it's a subclass of subclass
Dynamically load fqn class and verify it s a subclass of subclass
def load_dynamic_class(fqn, subclass):
    """
    Dynamically load fqn class and verify it's a subclass of subclass
    """
    if not isinstance(fqn, basestring):
        return fqn

    cls = load_class_from_name(fqn)

    if cls == subclass or not issubclass(cls, subclass):
        raise TypeError("%s is not a valid %s" % (fqn, subclass.__name__))

    return cls
def load_dynamic_class ( fqn , subclass ) : if not isinstance ( fqn , basestring ) : return fqn cls = load_class_from_name ( fqn ) if cls == subclass or not issubclass ( cls , subclass ) : raise TypeError ( "%s is not a valid %s" % ( fqn , subclass . __name__ ) ) return cls