20130812 (Monday, 12 August 2013)

Avoid a globally available module called settings.py

Puah, gestern und gerade habe ich zwei Stunden lang nach einem saudoofen Bug gesucht.

Symptom war, dass seit einiger Zeit die Lino-API nicht mehr generiert werden konnte. Da kamen lauter ImportError-Meldungen. Was üblicherweise daher kommt, dass autodoc zum Generieren der Seiten unterhalb von https://www.lino-framework.org/api/lino.html all diese Module importieren muss, was ja bekanntlich nicht einfach ist. Weshalb es ja eine fiktive Lino-Anwendung gibt (“Lino Docs” heißt sie seit heute), die “sozusagen alle” modlib-apps installiert. Deren settings.py ist nicht z.B. als lino.projects.docs.settings definiert, sondern lediglich in docs/settings.py. Weil sie in lino.projects eher stören würde.

Ursache war, dass ich versehentlich mit pip ein lokales Verzeichnis im Python-Path hatte, das ein settings.py enthielt.

Damit das in Zukunft schneller auffällt, habe ich jetzt in der docs/conf.py stehen:

import settings
if Path(settings.__file__).parent != Path(__file__).parent :
    raise Exception("""
Oops: `import settings` finds a settings module in %s.
See `blog/2013/0812.rst` and clean up your Python path!""" % Path(settings.__file__).parent)

Documentation for power users

Started a new section of the general Lino documentation: https://www.lino-framework.org/user/index.html.

The second body template

Added the second body template for Lino Welfare: lino_welfare/config/notes/Note/anw.body.html.

Which shows that we are going to also use template inheritance.

Minor changes in lino.modlib.events

My crazy breaking-a-fly-on-the-wheel project of using a Lino application to generate the http://www.vor-cycling.be/ website required some expertise because they asked me to add a simple external link for one event. Inspect the diffs for lino/modlib/events/fixtures/vor.py and lino/modlib/events/models.py to discover how “simple” this was…

Yes this is overkill, but it’s a nice challenge and a good exercise for Lino and me. And (at least my feeling says so:) I now need less time for maintaining this site! Se non è vero, è ben trovato;-)