def discover():

    logger.debug("Analyzing Tables...")
    #~ logger.debug("20111113 Register Table actors...")
    for rpt in actors.actors_list:
        if issubclass(rpt, Table) and rpt is not Table:
            register_report(rpt)
        elif issubclass(rpt, VirtualTable) and rpt is not VirtualTable:
            register_report(rpt)
        if issubclass(rpt, frames.Frame) and rpt is not frames.Frame:
            register_frame(rpt)

    logger.debug("Instantiate model tables...")
    for model in get_models():

        # Not getattr but __dict__.get because of the mixins.Listings
        # trick.
        rpt = model.__dict__.get('_lino_default_table', None)
        #~ rpt = getattr(model,'_lino_default_table',None)
        #~ logger.debug('20111113 %s._lino_default_table = %s',model,rpt)
        if rpt is None:
            rpt = table_factory(model)
            if rpt is None:
                raise Exception("table_factory() failed for %r." % model)
            register_report(rpt)
            rpt.class_init()
            #~ rpt.collect_actions()
            model._lino_default_table = rpt

    logger.debug("Analyze %d slave tables...", len(slave_reports))
    for rpt in slave_reports:
        if isinstance(rpt.master, basestring):
            raise Exception("20150216 unresolved master")
        if issubclass(rpt.master, models.Model):
            # rpt.master = resolve_model(rpt.master)
            slaves = getattr(rpt.master, "_lino_slaves", None)
            if slaves is None:
                slaves = {}
                rpt.master._lino_slaves = slaves
            slaves[rpt.actor_id] = rpt
        #~ logger.debug("20111113 %s: slave for %s",rpt.actor_id, rpt.master.__name__)
    #~ logger.debug("Assigned %d slave reports to their master.",len(slave_reports))

    #~ logger.debug("reports.setup() done")
This is being called at startup.
dataset/ETHPy150Open lsaffre/lino/lino/core/dbtables.py/discover