================================== 20130710 (Wednesday, 10 July 2013) ================================== Inheriting `config` directory of another app -------------------------------------------- Added a new module :mod:`lino.modlib.auto.sales` which extends :mod:`lino.modlib.trading` and is a next example of what I'd call "app inheritance". The base `sales` app is for writing sales invoices, the "auto" sales app is for having Lino automatically generate sales invoices. It works basically like :mod:`lino_faggio.contacts` (which extends :mod:`lino.modlib.contacts`, see :blogref:`20130607`). This time there was a new challenge: how can I say that I want to "inherit" the document template for Invoices? The answer is inspired by a technique to extend the Pythonpath: simply add a file :srcref:`config.pth ` (the name must end with :file:`.pth`) to the app's directory (i.e. the directory which contains the :file:`models.py` file). This file should contain one line for each additional `config` dir to add. Lino-Faggio continued --------------------- - `lino_xl.lib.cal.Event` and `lino_xl.lib.cal.Room` are now overridable. - :mod:`lino_faggio` uses this to make Events invoiceable - cal.Room is no longer a ContactRelated by default because many applications don't need this. :mod:`lino_faggio` overrides it to make it ContactRelated. - :mod:`lino_faggio` now also adds new fields `Event.organizer` `cal.Room.tariff` - New app :mod:`lino_faggio.cal` extends :mod:`lino_xl.lib.cal` Inheriting `config` directory of another app (continued) -------------------------------------------------------- After having checked in the above changes, I understood that we don't want an additional file `config.pth`: - that's one file more - it doesn't work for making :mod:`lino_faggio.cal` inherit the config of :mod:`lino_xl.lib.cal` (because the former cannot easily know the path of the latter). The new approach is to use magic module-level variable `PARENT_APP` which holds as a string the full Python name of the parent app. I also want this to happen in the `models` module and not in the app's `__init__.py` file. A side effect is that I cannot any longer import mod:`lino.utils.config` at the global level of a models module because importing it will fill the config dirs, i.e. will try to import every installed `models` module. Added new function :func:`lino.dd.extends_app`. To have :mod:`lino_faggio.cal` extend :mod:`lino_xl.lib.cal`, we now need only one line of code:: dd.extends_app('lino.modlib.trading',globals()) Lino-Faggio continued --------------------- - Renamed `lino.modlib.school` to `lino.modlib.courses`. - New module :mod:`lino_faggio.courses` extends :mod:`lino.modlib.courses`. - Repaired test suites Is it a demo site or not? ------------------------- There are meanwhile at least three different versions of :file:`admin_main.html` templates, partly with overlapping content, and already there are some subtle bugs. The :file:`admin_main.html` has sections that are important on a public demo site, but certainly not on a production site. For example the list of possible user names and their password::

{{_("This demo site has %d users, they all have \"1234\" as password:") % site.modules.users.UsersOverview.request().get_total_count()}}

{{as_ul('users.UsersOverview')}} Or (on another place of the template)::

{{_("Your feedback is welcome to lino-users@googlegroups.com or directly to the person who invited you.")}}

Solution: - New Site attribute :attr:`is_demo_site ` - Added usage of Jinja's `template inheritance `__. Checkin and upgrade on :ref:`lf`.