========================
Thursday, March 19, 2015
========================

Hydra hunting with Mahmoud
==========================

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

Added :mod:`lino.projects.docs.test` which caused them to appear.

The first bug was that :mod:`lino.modlib.cv` specified a
:attr:`required <lino.core.actors.Actor.required>` with
``user_groups="integ"`` for most tables.  That user group exists only
in :ref:`welfare`.

Instead of simply removing it in :mod:`lino.modlib.cv` (and adding it
afterwards again in :mod:`lino_welfare.modlib.cv`), I invented the
:meth:`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 :class:`LanguageKnowledges
<lino.modlib.cv.models.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 :mod:`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
:meth:`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
:class:`lino.modlib.users.choicelists.UserLevels` for each.  Added a
new tested document :lino:`/tested/cv` 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
:meth:`UserProfiles.reset
<lino.modlib.users.choicelists.UserProfiles.reset>` with an explicit
list of groups and :meth:`UserProfiles.add_item
<lino.modlib.users.choicelists.UserProfiles.add_item>` with a
`memberships` attribute.