20130607 (Friday, 07 June 2013)

“api/ui/Home/-99998 was not found on this server”

Trying to reproduce a problem report by Flavio:

Following the recommendations according to Lino web site, I set up a deployment environment with Apache and HTTP authentication, first for demo application Lino Cosí. The application loads the Javascript files, accesses the database and returns back the full name of the logged-in user, but got the following error after the authentication:

“Not Found
The requested URL / api/ui/Home/-99998 was not found on this server.”

Which happens in any attempt to access the information in the database such as in /api/contacts/Persons.

At first sight I could not reproduce this problem with the latest development version on a development server. Which version is he using? Going to set up a test environment for Apache HTTP authentication since the problem might occur only then.

The problem must be somewhere in his Apache configuration because the error message is issued by Apache. Apache doesn’t even forward that request to the WSGI process.

Fixed a bug which is probably unrelated: ExtRenderer generated a line which requested a file “/media/extensible/extensible-all-debug.js” which always lead to a 404 error, but that did no harm since it was useless.


Oops, the above bug was even more subtile: the link wasn’t useless at all (when use_extensible is set, which just happenes to not be the case in Lino Così), and the bug was that Lino didn’t take into account here extensible_base_url setting.


Continued with lino_faggio. We are facing a new challenge for Lino: how to integrate the modlib sales invoicing to a meeting manager application. And the first steps were very promising. But let me get it up and running before talking more about it…

One challenge was: when selecting an enrolment in an invoice item, we want to (1) show only the enrolements of the invoice receiver (this was easily done using a chooser) (2) format the choices to be displayed in the combo box to not repeat the participant’s name. That was more difficult because it is the first use case of such a situation.

Solution: Added a new customization hook for displaying a choice’s text: get_choices_text on the actor. Unlike a get_choices_text method on a model, this time we want to customize only forthe calling actor.

Note that I prefer this paradigm over another magic method FOO_choice_display on the model because:

  • magic model methods aren’t a good practice
  • The get_choices_text trick works even when there is no chooser at all.


One detail remains to be done though (because it is not new and i consider it secondary): when the invoice receiver changes, then the combobox should reload its store.

Overriding modlib models

I reached a next level of understanding how Lino should provide a possibility to override modlib models: Lino-Faggio overrides a whole modlib module by defining lino_faggio.contacts.

Why is this necessary? Summary: The lino.modlib.school requires the concrete class of contacts.Person, and because lino_faggio.models (who defines this class) cannot then also use the schools module. So I had to split lino_faggio.models: one who implements the concrete Person model and another who uses the school module. And because I didn’t want to create a new app_name, I tried to override the lino.modlib.contacts module.