Thursday, December 21, 2017

Reception clerks should see the calendar tab

In lino_welfare.projects.eupen, a reception clerk (user type 210) now can see the Calendar tab because it contains the EntriesByClient panel.

I changed the required roles for that panel from just OfficeUser to (OfficeUser, OfficeOperatoir):


I added a __getitem__() method to BaseLayout to make the following doctest snippet more readable:

>>> print(py2rst(pcsw.Clients.detail_layout['calendar']))
**Kalender** (calendar) [visible for 100 110 120 200 210 220 300 400 410 500 510 800 admin 910]:
- **Kalendereinträge** (cal.EntriesByClient)
- **Aufgaben** (cal.TasksByProject) [visible for 100 110 120 200 300 400 410 500 510 admin 910]

Above snippets are being tested in Users.

The Welfare test suite is currently failing because #2223 asks to make the contracts tab visible as well. And some details are waiting customer feedback.

While working on this ticket, I stubled into #2226 which needs to get fixed before #2223 can be closed.


I tried the new lino_welfare.modlib.aids.ConfirmationChecker on their production data:

$ python checkdata aids.ConfirmationChecker
Found 536 and fixed 0 data problems in Income confirmations.
Found 92 and fixed 0 data problems in Refund confirmations.
Found 55 and fixed 0 data problems in Simple confirmations.
Done 3 checkers, found 683 and fixed 0 problems.

I fixed a minor bug causing a traceback when a confirmation had no granting.

RemoteUserMiddleware without SessionMiddleware

Another problem was this:


File "/site-packages/django/core/handlers/" in inner
  41.             response = get_response(request)

File "/site-packages/django/core/handlers/" in _legacy_get_response
  244.             response = middleware_method(request)

File "/lino/lino/core/auth/" in process_request
  89.             if request.user.get_username() == self.clean_username(username, request):

File "/lino/lino/core/auth/" in clean_username
  110.         backend_str = request.session[auth.BACKEND_SESSION_KEY]

File "/site-packages/django/contrib/sessions/backends/" in __getitem__
  57.         return self._session[key]

Exception Type: KeyError at /
Exception Value: '_auth_user_backend'

Playing with forms

>>> from lino import startup
>>> startup('')
>>> from lino.api.doctest import *
>>> from django.forms
>>> from django.forms import ModelForm
>>> from django import forms