Tuesday, June 21, 2016

I continued on #985: new command inv bh. Optimizations in lino.sphinxcontrib.help_text_builder. Started to convert existing help_text attributes to attribute directives. All major applications (Lino Noi, Lino Voga, Lino Welfare and/or Lino Presto) now have this feature enabled.

TODO:

  • Convert help_text strings to attribute directives.

  • How to solve the problem that inv bh needs lino? Actually we should split atelier.invlib and move certain commands to a new module lino.utils.invlib. But then we would need to split the documentation page on Invoke commands into two different pages. I want to be able to run pp inv bh, i.e. in a project like News which has no help_texts_tree defined, the inv bh should not fail but simply do nothing. OTOH I also want atelier to stay simple. People who have no Lino application at all should not get scared away by lots of functions they don’t care about. To be meditated…

Stream-lining Initial Setup

James had some interesting ideas for making the “Getting started” guide more user-friendly.

Yes, of course it is important to avoid scaring away new and future Lino fans by a too high level at the entrance door. I opened #986 for this.

My first reactions:

  • The “Getting started” section of the Dive into Lino should not simplify things because:

    • Cloning the repositories and working in development mode is necessary because these instructions are primarily meant for future core developers who are able to submit pull requests.

    • Even our future system administrator (who doesn’t need to be a Python programmer) should be experienced enough to not get scared away by these instructions.

  • Indeed we should start to have a really user-friendly installation guide, targeted to “system administrators who just want to give Lino a quick try”, And this should indeed be as simple as pip install lino_noi.

  • Such an installation guide cannot be in the documentation of the framework, it must be in the docs of a given existing application (Lino Noi, Lino Voga, Lino Welfare and/or Lino Presto).

AttributeError: ‘Event’ object has no attribute ‘update_cal_summary’

This error message came when the user tried to update the auto_type field of a generated calendar event.

IntegrityError: (1062, “Duplicate entry ‘2313’ for key ‘PRIMARY’”)

Alexa and I failed to merge participants 2210 and 2313 in their database. A first inspector script revealed that they both have related Guest objects which are not being reported by the MergeAction.

Trying to reproduce this problem caused a minor new feature and a side effect:

  • Show lino_xl.lib.cal.ui.GuestsByPartner table (“presences”) in the partner detail in Lino Voga. This table also has a slave summary now.

  • I changed the verbose_name of lino_xl.lib.cal.Guest from “Participant” to “Presence”.

Select Activities ‣ Participants, go to Dorothée Demeulenaere, click the Merge action.

Lino asks the following confirmation:

Are you sure you want to merge Mrs Dorothée Demeulenaere into Mrs Dorothée Dobbelstein?

  • 1 Participants will get reassigned.

  • Mrs Dorothée Demeulenaere will be deleted

When you confirm, then you get:

Cannot delete Partner Demeulenaere Dorothée because 5 Bank Statement items refer to it.

But actually it has been deleted.

When analyzing the code (lino.core.merge), it seems that Lino currently does not care at all about MTI parents. For example, when merging two participants, then it sees their enrolments but not e.g. their invoices, bank statements etc (i.e. ignores all related objects pointing to this participant as person or partner).

I am surprised that this problem did not appear already in Lino Welfare. A possible explanation is that most of their related objects are linked via the MTI leaf (Client).

To solve the problem, I added a new function traverse_ddh_fklist().

lino_cosi.projects.std.tests.test_cosi now does a merge action of two Person objects and covers this problem.