Beispiel #1
0
def get_subclasses_recursively(entity, strict=True, proxies=False, excluded_subclasses=[]):
    """Return all subclasses of a :class:`Model` in a recursive manner."""
    subclasses = list()
    for subclass in get_subclasses(entity, proxies):
        if not subclass in excluded_subclasses:
            subclasses.append(subclass)
            subclasses.extend(get_subclasses_recursively(subclass))
    if not strict and (not entity in excluded_subclasses):
        subclasses.insert(0, entity)
    return subclasses
Beispiel #2
0
def subclasses(entity, proxies=False):
    """Return all direct subclasses of the specified :class:`Model`."""
    classes = SortedDict()
    for subclass in get_subclasses(entity, proxies):
        classes[subclass.__name__.lower()] = subclass
    return classes