Tuesday, March 3, 2015

Lino and Django 1.7

Mahmoud and I started yesterday to work on #38 (Convert to Django 1.7).

When upgrading to Django 1.7, the fab initdb fails already on the first demo database. You can reproduce the current state as follows:

$ cd lino/projects/docs
$ ./initdb_tmp

In the current development version, this causes an exception:

Problem installing fixture ‘…/lino/modlib/users/fixtures/demo.py’: User(username=’robin’,…,language=’en’,…) : {‘language’: [u”Value ‘en’ is not a valid choice.”]}

Cannot find first and last names in %r

This error message was sent as an admin email when a user had submitted an insert form with a non-parsable doctor name on a lino_welfare.modlib.aids.models.RefundConfirmation.

It was caused by lino.modlib.contacts.utils.parse_name(). I changed the exception type from Warning to ValidationError.

Another solution might have been to extend lino.core.store.Store.form2obj() so that it also digests Warning exceptions. I am undecided which one to prefer. Warning has the advantage of being a built-in exception type while ValidationError is from Django. On the other hand this built-in Warning is not actually meant for being used by code as mine, it is used by the warnings module as a warning category.

Acting as a former colleague?

Hubert fragte:

da ich den VSE #645 vor Ablauf (30/09/2016) “beenden” muss, um einen neuen Vertrag mit neuem Inhalt/Ziel generieren zu können, müsste ich arbeiten “als Nicolas” (Schöpfer dieses Vertrages). Wenn ich das aber versuche, kommt folgende Fehlermeldung: Server Error (500)

Meine Antwort:

Die momentane Logik ist: Nicolas hat sein Feld Benutzerprofil auf leer, dadurch ist er deaktiviert. Deshalb kann man auch nicht “als Nicolas” arbeiten. Denn “als jemand arbeiten” bedeutet auch, dessen Benutzerprofil zu übernehmen. Dass Lino den Nicolas trotzdem in der Auswahlliste “arbeiten als” anzeigt, ist ein Bug.

Hubert möchte hier ja auch eigentlich gar nicht “als Nicolas” arbeiten, sondern lediglich (als Hubert) einen Vertrag ändern, dessen Autor Nicolas ist.

Du könntest Hubert mal kurz zum Dienstleiter ernennen (Profil von 400 auf 410 ändern), damit er anderer Leute Verträge bearbeiten kann.

Das Recht, anderer Leute Verträge bearbeiten zu können, kann momentan nicht anders erteilt werden als durch so einen Profilwechsel. Macht es Sinn, dass wir das feiner regelbar machen? Z.B. durch ein Ankreuzfeld “Kann anderer Leute Dokumente bearbeiten” pro Benutzer.

  • Lino allowed to create appointments for a user without profile

  • Lino showed also users without profile in the Act as… menu of non-manager users.

About prompt consultations and newcomer appointments

I recently thought that newcomer_appointments and newcomer_consultations are useless because we can test newcomer_quota instead. Nope, I was wrong.

In lino_welfare.modlib.reception we use them as additional arguments to the appointable_users function because we want to see only