20140208 (Saturday, 08 February 2014)

Continued to work on attestations.

Changes:

  • In lino_welfare.fixtures.std: both attestation types “Bescheinigung Ausländerbeihilfe” and “Anwesenheitsbescheinigung” now use the same body template default.body.html which tests on the type of the owner for content.

  • A new virtual field preview

  • New action show_attestations next to issue_attestation

The following (internal) problem took me some time:

  • lino.modlib.attestations defines a template attestations/Attestation/Default.odt, and Lino Welfare overrides this template. If there were a module lino_welfare.modlib.attestations, then things would be different, but it currently does this by defining the same template the config directory of the lino_welfare app.

    But the get_installed_plugins in lino_welare.settings yields lino_welfare before lino.modlib.attestations, and the rule is that the *last* app wins when Lino loads templates.

    So Lino is right, and this was “just” a bug in application code (but a subtle one)

    I finally fixed the problem by simply yielding ‘attestations’ before ‘lino_welfare’. Here is a test case which verifies the actual path:

    >>> import os
    >>> os.environ['DJANGO_SETTINGS_MODULE'] = 'lino_welfare.settings.demo'
    >>> from lino.utils.config import find_config_file
    >>> ffn = find_config_file('Default.odt','attestations/Attestation')
    >>> ffn.endswith('lino_welfare/config/attestations/Attestation/Default.odt')
    True
    

    (Note: the above snippet os no longer tested here, it has been copied to General overview of Lino Welfare)