Thursday, March 19, 2015

Hydra hunting with Mahmoud

Mahmoud discovered several bugs which had slipped undiscovered through the test suite.

Added lino.projects.docs.test which caused them to appear.

The first bug was that lino.modlib.cv specified a required with user_groups="integ" for most tables. That user group exists only in Lino Welfare.

Instead of simply removing it in lino.modlib.cv (and adding it afterwards again in lino_welfare.modlib.cv), I invented the lino.core.plugin.Plugin.get_default_required() method. This is a simple hook for adding application-specific group requirements to all actors of a plugin.

Note that LanguageKnowledges and two subclasses thereof specified another user group “coaching”. I hope that this was by mistake. If it wasn’t, then the above hook is not yet a solution.

Another bug was in lino.modlib.postings. This was just a typo.

And yet another bug which we discovered together while I explained to Mahmoud above things: the default implementation of lino.core.site.Site.setup_user_profiles() incorrectly initialized the level attributes of user profiles with the name (a string value) instead of the choice instance from lino.modlib.users.choicelists.UserLevels for each. Added a new tested document https://www.lino-framework.org/tested/cv.html which helped me to understand the reason and which verifies that the bug is fixed. This problem did not appear in any real application because these use UserProfiles.reset with an explicit list of groups and UserProfiles.add_item with a memberships attribute.