Friday, March 13, 2015

Repairable data

(Continued from yesterday.)

I applied the new feature lino.mixins.repairable to lino.modlib.addresses : get_primary_address no longer has an “optional side effect”, but that functionality is now in AddressOwner.get_repairable_problems.

And also lino.modlib.cal now detects repairable data: cal.Event.get_repairable_problems.

Note that when AddressOwner.get_repairable_problems detects some repairable data, e.g. Unique address is not marked primary., then repairdata it will usually report this message several times: a first time for the Partner, another time for the Person or Company.

Yearly index page of a daily blog

A little change in atelier.sphinxconf.blog: the toctree of the yearly index page (blogger_year) is no longer hidden.

Dupables are now repairable

This is one of the situations which make me love Lino: after finishing with the “Repairable data” topic (mostly needed for Chatelet, and Eupen started to ask impatiently what I am doing), I turned back to Eupen who want to find their dupable partners. And what do I see? I see this code at the end of lino.mixins.dupable:

def update_all_dupable_words():
    """To be called after initializing a demo database, e.g. from
    `lino_welfare.fixtures.demo2`.

    """
    raise Exception("Not yet used. Maybe once as an action on SiteConfig.")
    for m in settings.SITE.models_by_base(Dupable):
        for obj in m.objects.all():
            obj.update_dupable_words()

All this is no longer necessary because now we have the repairdata command! I just needed to write a lino.mixins.dupable.Dupable.get_repairable_problems() method.