Wednesday, September 23, 2015

I am working to repair the Lino Welfare test suite after #520.

Exception: Invalid endtag. Expected </b>, found <p>

I encountered a problem #535, actually caused by #473. The easisest way to reproduce it is to cd to lino_welfare.projects.std and to run initdb_tmp script there. Here is a traceback:

INFO Loading /lino/lino/modlib/excerpts/fixtures/demo2.py...
INFO appy.pod render /welfare/lino_welfare/modlib/immersion/config/immersion/Contract/StageForem.odt -> /lino_cache/welfare_std/media/userdocs/appyodt/immersion.Contract-1.odt (language='en',params={'raiseOnError': True, 'ooPort': 8100, 'pythonWithUnoPath': '/usr/bin/python3'}
Traceback (most recent call last):
  ...
  File "/lino/lino/modlib/excerpts/fixtures/demo2.py", line 31, in objects
    rv = ses.run(obj.do_print)
  ...
  File "/appy/pod/actions.py", line 149, in evaluateBuffer
    self.manageError(result, context, msg, e)
  File "/appy/pod/actions.py", line 83, in manageError
    raise EvaluationError(originalError, errorMessage)
appy.pod.actions.EvaluationError: Problem installing fixture '/lino/lino/modlib/excerpts/fixtures/demo2.py': Error while evaluating the expression "html(body)" defined in the "from" part of a statement. Exception: Invalid endtag. Expected </b>, found <p>

The solution is to install HTML Tidy:

$ sudo aptitude install tidy

See lino.utils.html2xhtml.

Adapt Welfare test suite to #505

The specs page in Lino Welfare à la Eupen reveals that we cannot just show the statements and movements imported for managed client accounts to every ContactsUser. This information must be visible to social agents only. Not e.g. for reception clerks. But a reception clerk must see the accounts of a partner. Thus we need new user roles in lino_xl.lib.sepa.roles. And lino_welfare.modlib.welfare.roles distributes them to user profiles.

Note that reception clerks must be able to create accounts on a partner.

Commit and push Lino, Cosi and Welfare at 11.24 since the test suites now pass.

Manual tests revealed some problems that were not covered by the test suite:

  • Reception clerks did not see AccountsByPartner at all. Because I had been setting required_roles to:

    dd.login_required(ContactsUser, SepaUser)
    

    instead of:

    dd.login_required((ContactsUser, SepaUser))
    
  • Added an insert_layout to Accounts and AccountsByPartner.

  • Actually reception clerks should even not see any detail window per account. But that’s less easy. To implement this, we must extend Lino to support required_roles on a layout. Ticket #539.

    As a workaround I set stay_in_grid to True so that they don’t get it when creating an account.

  • Note that instead of writing:

    class AccountsDetail(dd.FormLayout):
        main = "general"
    
        general = dd.Panel("""
        partner:30 iban:40 bic:20 remark:15
        sepa.StatementsByAccount
        """, label=_("Account"))
    
    class Accounts(dd.Table):
        detail_layout = AccountsDetail()
    

    it is equivalent but shorter to write:

    class AccountsDetail(dd.FormLayout):
        main = """
        partner:30 iban:40 bic:20 remark:15
        sepa.StatementsByAccount
        """
    
    class Accounts(dd.Table):
        detail_layout = AccountsDetail()
    

    and even shorter:

    class Accounts(dd.Table):
        detail_layout = """
        partner:30 iban:40 bic:20 remark:15
        sepa.StatementsByAccount
        """
    

Exercise for Hamza After committing and pushing, I saw that one test in Lino Così (file docs/tested/general.rst) is still failing. The site admin (username “rolf”) no longer sees three menu items in Explorer menu. It is because the user profiles defined in lino_cosi.lib.cosi.roles do not yet include the new roles from lino_xl.lib.sepa.roles. Try to fix it and to write a pull request!

Moved tickets and clocking from Lino to Lino Noi

As with #520 I moved two plugins from the central Lino repository to Lino Noi: The tickets and clocking plugins are now in lino_noi.lib and no longer in lino.modlib.

Memo markup in ticket descriptions

Just an idea that had been haunting me for a few weeks already: #541. The description of a ticket can now contain “memo markup”. This is a general new feature of lino.modlib.bootstrap3. To be documented.

For example:

[url http://www.example.com]
[url http://www.example.com example]

[ticket 1]

Memo markup is being “executed” when the ticket is rendered by the lino.modlib.bootstrap3 user interface.

And it works :-) The description of #541 is entered as:

Example: we can now link to [ticket 1] and to external URL
[url http://luc.lino-framework.org/blog/2015/0923.html blog].

To be observed. This is admittedly less intuitive than automatically replacing every # followed by a sequence of digits, and every chunk of text starting with http:// by a link.